diff --git a/packages/hoppscotch-app/components/app/Footer.vue b/packages/hoppscotch-app/components/app/Footer.vue index 845265a52..9fdc06d7e 100644 --- a/packages/hoppscotch-app/components/app/Footer.vue +++ b/packages/hoppscotch-app/components/app/Footer.vue @@ -4,7 +4,7 @@
- +
- {{ `${$t("app.name")} ${$t("app.version")}` }} + {{ `${t("app.name")} ${t("app.version")}` }}
@@ -116,19 +116,19 @@ manage_search - {{ $t("state.nothing_found") }} "{{ search }}" + {{ t("state.nothing_found") }} "{{ search }}"
@@ -26,6 +26,9 @@ import { computed, onUnmounted, onMounted } from "@nuxtjs/composition-api" import Fuse from "fuse.js" import { useArrowKeysNavigation } from "~/helpers/powerSearchNavigation" import { HoppAction } from "~/helpers/actions" +import { useI18n } from "~/helpers/utils/composables" + +const t = useI18n() const props = defineProps<{ input: Record[] diff --git a/packages/hoppscotch-app/components/app/Header.vue b/packages/hoppscotch-app/components/app/Header.vue index 246eb7ee8..8566bd728 100644 --- a/packages/hoppscotch-app/components/app/Header.vue +++ b/packages/hoppscotch-app/components/app/Header.vue @@ -15,21 +15,21 @@
@@ -86,13 +86,13 @@ @@ -110,18 +110,20 @@ diff --git a/packages/hoppscotch-app/components/http/Headers.vue b/packages/hoppscotch-app/components/http/Headers.vue index 683a9e3f1..82d023554 100644 --- a/packages/hoppscotch-app/components/http/Headers.vue +++ b/packages/hoppscotch-app/components/http/Headers.vue @@ -14,32 +14,32 @@ " >
- {{ $t("empty.headers") }} + {{ t("empty.headers") }} diff --git a/packages/hoppscotch-app/components/http/Request.vue b/packages/hoppscotch-app/components/http/Request.vue index d964d7b60..d12101f7b 100644 --- a/packages/hoppscotch-app/components/http/Request.vue +++ b/packages/hoppscotch-app/components/http/Request.vue @@ -43,7 +43,7 @@ " :value="newMethod" :readonly="!isCustomMethod" - :placeholder="`${$t('request.method')}`" + :placeholder="`${t('request.method')}`" @input="onSelectMethod($event.target.value)" /> @@ -60,7 +60,7 @@
@@ -98,7 +98,7 @@ -import { computed, ref, useContext, watch } from "@nuxtjs/composition-api" +import { computed, ref, watch } from "@nuxtjs/composition-api" import { isRight } from "fp-ts/lib/Either" import { updateRESTResponse, @@ -227,6 +227,8 @@ import { useStreamSubscriber, useStream, useNuxt, + useI18n, + useToast, } from "~/helpers/utils/composables" import { defineActionHandler } from "~/helpers/actions" import { copyToClipboard } from "~/helpers/utils/clipboard" @@ -235,6 +237,8 @@ import { overwriteRequestTeams } from "~/helpers/teams/utils" import { apolloClient } from "~/helpers/apollo" import useWindowSize from "~/helpers/utils/useWindowSize" +const t = useI18n() + const methods = [ "GET", "POST", @@ -248,12 +252,9 @@ const methods = [ "CUSTOM", ] -const { - $toast, - app: { i18n }, -} = useContext() +const toast = useToast() const nuxt = useNuxt() -const t = i18n.t.bind(i18n) + const { subscribeToStream } = useStreamSubscriber() const newEndpoint = useStream(restEndpoint$, "", setRESTEndpoint) @@ -341,7 +342,7 @@ const copyRequest = () => { .catch(() => {}) } else { copyToClipboard(window.location.href) - $toast.success(`${t("state.copied_to_clipboard")}`) + toast.success(`${t("state.copied_to_clipboard")}`) } } @@ -380,7 +381,7 @@ const saveRequest = () => { if (saveCtx.originLocation === "user-collection") { editRESTRequest(saveCtx.folderPath, saveCtx.requestIndex, getRESTRequest()) - $toast.success(`${t("request.saved")}`) + toast.success(`${t("request.saved")}`) } else if (saveCtx.originLocation === "team-collection") { const req = getRESTRequest() @@ -393,14 +394,14 @@ const saveRequest = () => { saveCtx.requestID ) .then(() => { - $toast.success(`${t("request.saved")}`) + toast.success(`${t("request.saved")}`) }) .catch(() => { - $toast.error(`${t("profile.no_permission")}`) + toast.error(`${t("profile.no_permission")}`) }) } catch (error) { showSaveRequestModal.value = true - $toast.error(`${t("error.something_went_wrong")}`) + toast.error(`${t("error.something_went_wrong")}`) console.error(error) } } diff --git a/packages/hoppscotch-app/components/http/ResponseMeta.vue b/packages/hoppscotch-app/components/http/ResponseMeta.vue index ff9ff831c..439858df7 100644 --- a/packages/hoppscotch-app/components/http/ResponseMeta.vue +++ b/packages/hoppscotch-app/components/http/ResponseMeta.vue @@ -12,16 +12,16 @@
- {{ $t("shortcut.request.send_request") }} + {{ t("shortcut.request.send_request") }} - {{ $t("shortcut.general.show_all") }} + {{ t("shortcut.general.show_all") }} - {{ $t("shortcut.general.command_menu") }} + {{ t("shortcut.general.command_menu") }} - {{ $t("shortcut.general.help_menu") }} + {{ t("shortcut.general.help_menu") }}
@@ -42,7 +42,7 @@
- {{ $t("state.loading") }} + {{ t("state.loading") }}
- {{ $t("error.network_fail") }} + {{ t("error.network_fail") }} - {{ $t("helpers.network_fail") }} + {{ t("helpers.network_fail") }}
@@ -89,15 +89,15 @@ class="font-semibold space-x-4" > - {{ $t("response.status") }}: - {{ response.statusCode || $t("state.waiting_send_request") }} + {{ t("response.status") }}: + {{ response.statusCode || t("state.waiting_send_request") }} - {{ $t("response.time") }}: + {{ t("response.time") }}: {{ `${response.meta.responseDuration} ms` }} - {{ $t("response.size") }}: + {{ t("response.size") }}: {{ `${response.meta.responseSize} B` }}
@@ -110,6 +110,9 @@ import { computed } from "@nuxtjs/composition-api" import findStatusGroup from "~/helpers/findStatusGroup" import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse" import { getPlatformSpecialKey as getSpecialKey } from "~/helpers/platformutils" +import { useI18n } from "~/helpers/utils/composables" + +const t = useI18n() const props = defineProps<{ response: HoppRESTResponse diff --git a/packages/hoppscotch-app/components/http/TestResult.vue b/packages/hoppscotch-app/components/http/TestResult.vue index 64ce3ff3a..54283808b 100644 --- a/packages/hoppscotch-app/components/http/TestResult.vue +++ b/packages/hoppscotch-app/components/http/TestResult.vue @@ -1,5 +1,5 @@ diff --git a/packages/hoppscotch-app/components/lenses/renderers/RawLensRenderer.vue b/packages/hoppscotch-app/components/lenses/renderers/RawLensRenderer.vue index 0cf9e44df..ba3caba4c 100644 --- a/packages/hoppscotch-app/components/lenses/renderers/RawLensRenderer.vue +++ b/packages/hoppscotch-app/components/lenses/renderers/RawLensRenderer.vue @@ -14,13 +14,13 @@ " >
@@ -37,7 +37,7 @@ v-if="response.body" ref="copyResponse" v-tippy="{ theme: 'tooltip' }" - :title="$t('action.copy')" + :title="t('action.copy')" :svg="copyIcon" @click.native="copyResponse" /> @@ -48,20 +48,19 @@ diff --git a/packages/hoppscotch-app/components/lenses/renderers/XMLLensRenderer.vue b/packages/hoppscotch-app/components/lenses/renderers/XMLLensRenderer.vue index 131962840..891395ead 100644 --- a/packages/hoppscotch-app/components/lenses/renderers/XMLLensRenderer.vue +++ b/packages/hoppscotch-app/components/lenses/renderers/XMLLensRenderer.vue @@ -14,13 +14,13 @@ " >
@@ -37,7 +37,7 @@ v-if="response.body" ref="copyResponse" v-tippy="{ theme: 'tooltip' }" - :title="$t('action.copy')" + :title="t('action.copy')" :svg="copyIcon" @click.native="copyResponse" /> @@ -48,20 +48,19 @@ diff --git a/packages/hoppscotch-app/components/realtime/Log.vue b/packages/hoppscotch-app/components/realtime/Log.vue index 12ef953de..0821d929d 100644 --- a/packages/hoppscotch-app/components/realtime/Log.vue +++ b/packages/hoppscotch-app/components/realtime/Log.vue @@ -26,7 +26,7 @@ >{{ entry.ts }}{{ source(entry.source) }}{{ entry.payload }} - {{ $t("response.waiting_for_connection") }} + {{ t("response.waiting_for_connection") }}
@@ -34,6 +34,9 @@ diff --git a/packages/hoppscotch-app/components/teams/index.vue b/packages/hoppscotch-app/components/teams/index.vue index 5ecf7bbce..44d74bf0e 100644 --- a/packages/hoppscotch-app/components/teams/index.vue +++ b/packages/hoppscotch-app/components/teams/index.vue @@ -2,7 +2,7 @@
@@ -11,7 +11,7 @@ class="flex flex-col items-center justify-center" > - {{ $t("state.loading") }} + {{ t("state.loading") }}
- {{ $t("empty.teams") }} + {{ t("empty.teams") }} @@ -71,7 +71,7 @@ class="flex flex-col items-center" > help_outline - {{ $t("error.something_went_wrong") }} + {{ t("error.something_went_wrong") }}
@@ -114,6 +114,9 @@ import { MyTeamsQueryVariables, } from "~/helpers/backend/graphql" import { MyTeamsQueryError } from "~/helpers/backend/QueryErrors" +import { useI18n } from "~/helpers/utils/composables" + +const t = useI18n() defineProps<{ modal: boolean diff --git a/packages/hoppscotch-app/helpers/utils/composables.ts b/packages/hoppscotch-app/helpers/utils/composables.ts index 1bd14c7ba..e5ebdb437 100644 --- a/packages/hoppscotch-app/helpers/utils/composables.ts +++ b/packages/hoppscotch-app/helpers/utils/composables.ts @@ -140,3 +140,8 @@ export function useI18n() { } = useContext() return i18n.t.bind(i18n) } + +export function useToast() { + const { $toast } = useContext() + return $toast +} diff --git a/packages/hoppscotch-app/pages/profile.vue b/packages/hoppscotch-app/pages/profile.vue index 741b09024..2e371be83 100644 --- a/packages/hoppscotch-app/pages/profile.vue +++ b/packages/hoppscotch-app/pages/profile.vue @@ -17,13 +17,13 @@ w-24 inline-flex " - :alt="$t('empty.parameters')" + :alt="`${t('empty.parameters')}`" />

- {{ $t("empty.profile") }} + {{ t("empty.profile") }}

@@ -44,7 +44,7 @@

{{ currentUser.email }} @@ -61,7 +61,7 @@

@@ -71,19 +71,19 @@

- {{ $t("settings.profile") }} + {{ t("settings.profile") }}

- {{ $t("settings.profile_description") }} + {{ t("settings.profile_description") }}

- {{ $t("settings.sync") }} + {{ t("settings.sync") }}

- {{ $t("settings.sync_description") }} + {{ t("settings.sync_description") }}
@@ -120,7 +120,7 @@ :on="SYNC_COLLECTIONS" @change="toggleSetting('syncCollections')" > - {{ $t("settings.sync_collections") }} + {{ t("settings.sync_collections") }}
@@ -128,7 +128,7 @@ :on="SYNC_ENVIRONMENTS" @change="toggleSetting('syncEnvironments')" > - {{ $t("settings.sync_environments") }} + {{ t("settings.sync_environments") }}
@@ -136,13 +136,13 @@ :on="SYNC_HISTORY" @change="toggleSetting('syncHistory')" > - {{ $t("settings.sync_history") }} + {{ t("settings.sync_history") }}
- + @@ -156,21 +156,12 @@