From a1151b0f4fed828c0a3b626f9dba26cf46b1d529 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 22 Mar 2024 15:26:26 +0530 Subject: [PATCH] Implemented: support to use i18n from dxp and removed app level configuration of i18n(#280) --- .env.example | 4 +- src/App.vue | 13 ++- src/components/Menu.vue | 7 +- src/i18n/index.ts | 29 ----- src/{i18n => }/locales/en.json | 0 src/{i18n => }/locales/index.ts | 0 src/main.ts | 4 +- src/router/index.ts | 2 +- src/store/modules/order/actions.ts | 2 +- src/store/modules/product/actions.ts | 2 +- src/store/modules/user/actions.ts | 2 +- src/user-utils/index.ts | 2 +- src/views/background-job-modal.vue | 12 +- src/views/catalog-product-details.vue | 157 +++++++++++++------------- src/views/catalog.vue | 24 ++-- src/views/edit-shipping-modal.vue | 16 +-- src/views/job-actions-popover.vue | 21 ++-- src/views/job-history-modal.vue | 6 +- src/views/order-popover.vue | 28 ++--- src/views/orders.vue | 76 +++++++------ src/views/product-details.vue | 74 ++++++------ src/views/products.vue | 14 ++- src/views/promise-date-modal.vue | 20 ++-- src/views/settings.vue | 27 ++--- src/views/shipping-popover.vue | 8 +- src/views/timezone-modal.vue | 20 ++-- src/views/warehouse-modal.vue | 20 ++-- 27 files changed, 296 insertions(+), 294 deletions(-) delete mode 100644 src/i18n/index.ts rename src/{i18n => }/locales/en.json (100%) rename src/{i18n => }/locales/index.ts (100%) diff --git a/.env.example b/.env.example index 6002fc9cb..3f55fb180 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,8 @@ VUE_APP_CACHE_MAX_AGE=3600 VUE_APP_BASE_URL=VUE_APP_BASE_URL VUE_APP_RESOURCE_URL=VUE_APP_RESOURCE_URL -VUE_APP_I18N_LOCALE=en -VUE_APP_I18N_FALLBACK_LOCALE=en +VUE_APP_I18N_LOCALE=en-US +VUE_APP_I18N_FALLBACK_LOCALE=en-US VUE_APP_VIEW_SIZE=10 VUE_APP_CUST_LOYALTY_OPTIONS={"LoyaltyCustomer":"Pass", "LoyaltyPlusOrder":"Pass +"} VUE_APP_POLL_TIME=10000 diff --git a/src/App.vue b/src/App.vue index 5a592701c..9ff816873 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,7 +15,7 @@ import { } from "@ionic/vue"; import Menu from '@/components/Menu.vue'; import { defineComponent } from "vue"; -import { useI18n } from 'vue-i18n' +// import { useI18n } from 'vue-i18n' import TaskQueue from './task-queue'; import OfflineHelper from "./offline-helper" import emitter from "@/event-bus" @@ -24,6 +24,7 @@ import { mapGetters, useStore } from 'vuex'; import { Settings } from 'luxon' import { initialise, resetConfig } from '@/adapter' import { useRouter } from 'vue-router'; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "App", @@ -51,7 +52,7 @@ export default defineComponent({ if (!this.loader) { this.loader = await loadingController .create({ - message: this.$t("Click the backdrop to dismiss."), + message: translate("Click the backdrop to dismiss."), translucent: true, backdropDismiss: true }); @@ -90,7 +91,7 @@ export default defineComponent({ async mounted() { this.loader = await loadingController .create({ - message: this.$t("Click the backdrop to dismiss."), + message: translate("Click the backdrop to dismiss."), translucent: true, backdropDismiss: true }); @@ -111,14 +112,14 @@ export default defineComponent({ const store = useStore(); TaskQueue.init(); OfflineHelper.register(); - const { t, locale } = useI18n(); + // const { t, locale } = useI18n(); const router = useRouter(); return { router, TaskQueue, OfflineHelper, - t, - locale, + // t, + // locale, store }; }, diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 214da3f38..8bff4a212 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -2,7 +2,7 @@ - {{ $t("Preorder Management")}} + {{ translate("Preorder Management")}} @@ -40,7 +40,7 @@ import { } from "@ionic/vue"; import { computed, defineComponent} from "vue" import { mapGetters } from "vuex"; - +import { translate } from "@hotwax/dxp-components"; import { albums ,shirt, pricetags, settings } from "ionicons/icons"; import { useStore } from "@/store"; import { useRouter } from "vue-router"; @@ -124,7 +124,8 @@ export default defineComponent({ settings, selectedIndex, shirt, - store + store, + translate }; } }); diff --git a/src/i18n/index.ts b/src/i18n/index.ts deleted file mode 100644 index 5e2fc7e50..000000000 --- a/src/i18n/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { createI18n } from 'vue-i18n' - -function loadLocaleMessages () { - const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i) - const messages: any = {} - locales.keys().forEach(key => { - const matched = key.match(/([A-Za-z0-9-_]+)\./i) - if (matched && matched.length > 1) { - const locale = matched[1] - messages[locale] = locales(key) - } - }) - return messages -} - -const i18n = createI18n({ - locale: process.env.VUE_APP_I18N_LOCALE || 'en', - fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en', - messages: loadLocaleMessages() -}) - -const translate = (key: string) => { - if (!key) { - return ''; - } - return i18n.global.t(key); -}; - -export { i18n as default, translate } \ No newline at end of file diff --git a/src/i18n/locales/en.json b/src/locales/en.json similarity index 100% rename from src/i18n/locales/en.json rename to src/locales/en.json diff --git a/src/i18n/locales/index.ts b/src/locales/index.ts similarity index 100% rename from src/i18n/locales/index.ts rename to src/locales/index.ts diff --git a/src/main.ts b/src/main.ts index f799e2f2c..6158dee81 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,6 @@ import App from './App.vue' import router from './router'; import { IonicVue } from '@ionic/vue'; -import i18n from './i18n' import store from './store' import { DateTime } from 'luxon'; import { sortSizes } from "@/apparel-sorter" @@ -33,14 +32,13 @@ import permissionPlugin from '@/authorization'; import permissionRules from '@/authorization/Rules'; import permissionActions from '@/authorization/Actions'; import { getConfig, initialise } from '@/adapter' -import localeMessages from './i18n/locales'; +import localeMessages from './locales'; const app = createApp(App) .use(IonicVue, { mode: 'md' }) .use(router) - .use(i18n) .use(store) .use(permissionPlugin, { rules: permissionRules, diff --git a/src/router/index.ts b/src/router/index.ts index 62d4a0b5f..b014cd045 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -11,7 +11,7 @@ import { DxpLogin, useAuthStore } from '@hotwax/dxp-components'; import { loader } from '@/user-utils'; import { hasPermission } from '@/authorization'; import { showToast } from '@/utils'; -import { translate } from '@/i18n'; +import { translate } from '@hotwax/dxp-components'; // Defining types for the meta values declare module 'vue-router' { diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 4475a0265..94a35f8c5 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -4,7 +4,7 @@ import RootState from '@/store/RootState' import OrderState from './OrderState' import * as types from './mutation-types' import { hasError, showToast } from '@/utils' -import { translate } from '@/i18n' +import { translate } from '@hotwax/dxp-components' import { DateTime } from 'luxon'; import emitter from '@/event-bus' diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index 49da7505f..032da995f 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -4,7 +4,7 @@ import RootState from '@/store/RootState' import ProductState from './ProductState' import * as types from './mutation-types' import { hasError, showToast } from '@/utils' -import { translate } from '@/i18n' +import { translate } from '@hotwax/dxp-components' import emitter from '@/event-bus' diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index a17187aa6..f66ec7b64 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -4,7 +4,7 @@ import RootState from '@/store/RootState' import UserState from './UserState' import * as types from './mutation-types' import { hasError, showToast } from '@/utils' -import { translate } from '@/i18n' +import { translate } from '@hotwax/dxp-components' import { Settings } from 'luxon' import { updateInstanceUrl, updateToken, resetConfig, logout } from '@/adapter' import { useAuthStore } from '@hotwax/dxp-components'; diff --git a/src/user-utils/index.ts b/src/user-utils/index.ts index 44c37aba1..480965220 100644 --- a/src/user-utils/index.ts +++ b/src/user-utils/index.ts @@ -1,4 +1,4 @@ -import { translate } from '@/i18n' +import { translate } from '@hotwax/dxp-components' import store from '@/store' import { loadingController } from '@ionic/vue' diff --git a/src/views/background-job-modal.vue b/src/views/background-job-modal.vue index 4f375184c..5e56572ac 100644 --- a/src/views/background-job-modal.vue +++ b/src/views/background-job-modal.vue @@ -6,7 +6,7 @@ - {{ $t("Background jobs") }} + {{ translate("Background jobs") }} @@ -14,13 +14,13 @@
-

{{ $t("There are no jobs running in the background right now.") }}

+

{{ translate("There are no jobs running in the background right now.") }}

- {{ $t("Active jobs") }} + {{ translate("Active jobs") }} {{ log.scriptTitle ? log.scriptTitle : log.description }} @@ -28,7 +28,7 @@ - {{ $t("Broker orders") }} + {{ translate("Broker orders") }} {{ job.runTime ? getDateTime(job.runTime) : '-' }} @@ -57,6 +57,7 @@ import { JobService } from '@/services/JobService' import { useStore } from "@/store"; import { mapGetters } from "vuex"; import { DateTime } from 'luxon'; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "BackgroundJobModal", @@ -104,7 +105,8 @@ export default defineComponent({ cloudDownload, build, closeOutline, - store + store, + translate }; }, }); diff --git a/src/views/catalog-product-details.vue b/src/views/catalog-product-details.vue index 363b7ad55..36336b97c 100644 --- a/src/views/catalog-product-details.vue +++ b/src/views/catalog-product-details.vue @@ -5,7 +5,7 @@ - {{ $t("Product audit") }} + {{ translate("Product audit") }} @@ -23,7 +23,7 @@
- {{ $t("Colors") }} + {{ translate("Colors") }} @@ -34,7 +34,7 @@ - {{ $t("Sizes") }} + {{ translate("Sizes") }} @@ -71,19 +71,19 @@
- {{ $t("Eligible") }} + {{ translate("Eligible") }} - {{ $t("Category") }} + {{ translate("Category") }} - {{ $t("Shopify listing") }} + {{ translate("Shopify listing") }} - {{ $t("Timeline") }} + {{ translate("Timeline") }} @@ -99,25 +99,25 @@ - {{ $t("Eligible") }} - {{ poSummary.eligible ? $t("Yes") : $t("No") }} + {{ translate("Eligible") }} + {{ poSummary.eligible ? translate("Yes") : translate("No") }} - {{ $t("Category") }} - {{ poSummary.categoryId === preOrderCategoryId ? $t('Pre-order') : poSummary.categoryId === backorderCategoryId ? $t('Back-order') : $t('None') }} + {{ translate("Category") }} + {{ poSummary.categoryId === preOrderCategoryId ? translate('Pre-order') : poSummary.categoryId === backorderCategoryId ? translate('Back-order') : translate('None') }} - {{ $t("Shopify listing") }} + {{ translate("Shopify listing") }} {{ poSummary.listingCountStatusMessage }} - {{ $t("Promise date") }} + {{ translate("Promise date") }} {{ poSummary.promiseDate }} - {{ $t("Timeline") }} + {{ translate("Timeline") }} @@ -160,8 +160,8 @@ -

{{ $t("Active purchase order") }}

-

{{ $t("Available purchase order") }}

+

{{ translate("Active purchase order") }}

+

{{ translate("Available purchase order") }}

@@ -171,49 +171,49 @@
- {{ $t('Pre-selling category') }} - {{ poAndAtpDetails.activePo?.isNewProduct === "Y" ? $t('Pre-order') : $t('Back-order') }} + {{ translate('Pre-selling category') }} + {{ poAndAtpDetails.activePo?.isNewProduct === "Y" ? translate('Pre-order') : translate('Back-order') }} - {{ $t("Ordered") }} + {{ translate("Ordered") }} {{ (poAndAtpDetails.activePo?.quantity >= 0) ? poAndAtpDetails.activePo?.quantity : '-' }} - {{ $t("Available") }} + {{ translate("Available") }} {{ (poAndAtpDetails.activePo?.availableToPromise >= 0) ? poAndAtpDetails.activePo?.availableToPromise : '-' }} - {{ $t("Corresponding sales orders") }} + {{ translate("Corresponding sales orders") }} {{ (poAndAtpDetails.crspndgSalesOrdr >= 0) ? poAndAtpDetails.crspndgSalesOrdr : '-' }} - {{ $t("Total PO items") }} + {{ translate("Total PO items") }} {{ (poAndAtpDetails.totalPoItems >= 0) ? poAndAtpDetails.totalPoItems : '-' }} - {{ $t("Total PO ATP") }} + {{ translate("Total PO ATP") }} {{ (poAndAtpDetails.totalPoAtp >= 0) ? poAndAtpDetails.totalPoAtp : '-' }}
-

{{ $t("Purchase orders") }}

+

{{ translate("Purchase orders") }}

- {{ $t("Total PO items") }} + {{ translate("Total PO items") }} {{ (poAndAtpDetails.totalPoItems >= 0) ? poAndAtpDetails.totalPoItems : '-' }} - {{ $t("Total PO ATP") }} + {{ translate("Total PO ATP") }} {{ (poAndAtpDetails.totalPoAtp >= 0) ? poAndAtpDetails.totalPoAtp : '-' }}
@@ -221,7 +221,7 @@ -

{{ $t("Online ATP calculation") }}

+

{{ translate("Online ATP calculation") }}

@@ -243,23 +243,23 @@
- {{ $t("Online ATP") }} + {{ translate("Online ATP") }} {{ (atpCalcDetails.onlineAtp >= 0) ? atpCalcDetails.onlineAtp : '-' }} - {{ $t("Quantity on hand") }} + {{ translate("Quantity on hand") }} {{ (atpCalcDetails.totalQOH >= 0) ? atpCalcDetails.totalQOH : '-' }} - {{ $t("Excluded ATP") }} + {{ translate("Excluded ATP") }} {{ (atpCalcDetails.excludedAtp || atpCalcDetails.excludedAtp === 0) ? atpCalcDetails.excludedAtp : '-' }} - {{ $t("Reserve inventory") }} + {{ translate("Reserve inventory") }} - {{ $t("Hold pre-order physical inventory") }} + {{ translate("Hold pre-order physical inventory") }}
@@ -272,7 +272,7 @@ -

{{ $t('Related jobs') }}

+

{{ translate('Related jobs') }}

@@ -289,31 +289,31 @@
-

{{ $t('Pre-sell computation') }}

+

{{ translate('Pre-sell computation') }}

{{ getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT').lastRunTime && timeTillJob(getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT').lastRunTime) }}

-

{{ getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT').runTime ? timeTillJob(getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT').runTime) : $t('disabled')}}

+

{{ getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT').runTime ? timeTillJob(getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT').runTime) : translate('disabled')}}

-

{{ $t('Order brokering') }}

+

{{ translate('Order brokering') }}

{{ getCtgryAndBrkrngJob('JOB_BKR_ORD').lastRunTime && timeTillJob(getCtgryAndBrkrngJob('JOB_BKR_ORD').lastRunTime) }}

-

{{ getCtgryAndBrkrngJob('JOB_BKR_ORD').runTime ? timeTillJob(getCtgryAndBrkrngJob('JOB_BKR_ORD').runTime) : $t('disabled')}}

+

{{ getCtgryAndBrkrngJob('JOB_BKR_ORD').runTime ? timeTillJob(getCtgryAndBrkrngJob('JOB_BKR_ORD').runTime) : translate('disabled')}}

-

{{ $t('Auto releasing') }}

+

{{ translate('Auto releasing') }}

{{ getCtgryAndBrkrngJob('JOB_RLS_ORD_DTE').lastRunTime && timeTillJob(getCtgryAndBrkrngJob('JOB_RLS_ORD_DTE').lastRunTime) }}

-

{{ getCtgryAndBrkrngJob('JOB_RLS_ORD_DTE').runTime ? timeTillJob(getCtgryAndBrkrngJob('JOB_RLS_ORD_DTE').runTime) : $t('disabled')}}

+

{{ getCtgryAndBrkrngJob('JOB_RLS_ORD_DTE').runTime ? timeTillJob(getCtgryAndBrkrngJob('JOB_RLS_ORD_DTE').runTime) : translate('disabled')}}

@@ -322,7 +322,7 @@ -

{{ $t('Shop listing status') }}

+

{{ translate('Shop listing status') }}

@@ -338,7 +338,7 @@
- {{ $t('No shop listings found') }} + {{ translate('No shop listings found') }} @@ -347,13 +347,13 @@

{{ listData.listingTimeAndStatus }}

-
{{ $t(listData.listingStatus) }}
+
{{ translate(listData.listingStatus) }}
-
{{ $t("No listing data") }}
+
{{ translate("No listing data") }}
-
{{ $t("Not linked") }}
+
{{ translate("Not linked") }}
@@ -400,7 +400,7 @@ import { useStore } from "@/store"; import { DxpShopifyImg } from "@hotwax/dxp-components"; import { mapGetters } from "vuex"; import { showToast, getFeature, hasError } from "@/utils"; -import { translate } from "@/i18n"; +import { translate } from "@hotwax/dxp-components"; import { sortSizes } from '@/apparel-sorter'; import { DateTime } from "luxon"; import JobActionsPopover from "./job-actions-popover.vue"; @@ -601,7 +601,7 @@ export default defineComponent({ if (!hasError(resp)) { this.poAndAtpDetails.totalPoAtp = resp.data?.futureAtp } else if (hasError(resp) && resp?.data?.error !== "No record found") { - showToast(this.$t("Something went wrong, could not fetch", { data: 'total ATP' })) + showToast(translate("Something went wrong, could not fetch", { data: 'total ATP' })) } const hasPreOrderCategory = productCategories?.includes(this.preOrderCategoryId); @@ -643,7 +643,7 @@ export default defineComponent({ resp = await OrderService.getActivePoDetails(payload) - if (hasError(resp) && resp?.data?.error !== "No record found") showToast(this.$t("Something went wrong, could not fetch", { data: 'active PO details' })) + if (hasError(resp) && resp?.data?.error !== "No record found") showToast(translate("Something went wrong, could not fetch", { data: 'active PO details' })) else this.poAndAtpDetails.activePo = resp.data?.error ? {}: resp.data?.docs[0] } else if (this.poAndAtpDetails.totalPoAtp > 0) { @@ -666,7 +666,7 @@ export default defineComponent({ resp = await OrderService.getActivePoDetails(payload) - if (hasError(resp) && resp?.data?.error !== "No record found") showToast(this.$t("Something went wrong, could not fetch", { data: 'active PO details' })) + if (hasError(resp) && resp?.data?.error !== "No record found") showToast(translate("Something went wrong, could not fetch", { data: 'active PO details' })) else { this.poAndAtpDetails.activePo = resp.data?.error ? {}: resp.data?.docs[0] this.poAndAtpDetails.activePoId = this.poAndAtpDetails.activePo.orderId @@ -684,7 +684,7 @@ export default defineComponent({ } } resp = await OrderService.getCrspndgSalesOrdr(payload) - if (resp && hasError(resp)) showToast(this.$t("Something went wrong, could not fetch", { data: 'corresponding sales order count' })) + if (resp && hasError(resp)) showToast(translate("Something went wrong, could not fetch", { data: 'corresponding sales order count' })) else this.poAndAtpDetails.crspndgSalesOrdr = resp?.data?.response.numFound } @@ -703,7 +703,7 @@ export default defineComponent({ "viewSize": 1 } resp = await OrderService.getPoItemCount(payload) - if (hasError(resp) && resp?.data?.error !== "No record found") showToast(this.$t("Something went wrong, could not fetch", { data: 'total PO items' })) + if (hasError(resp) && resp?.data?.error !== "No record found") showToast(translate("Something went wrong, could not fetch", { data: 'total PO items' })) else this.poAndAtpDetails.totalPoItems = resp.data?.error === "No record found" ? 0 : resp.data?.count // count is zero if not records are found @@ -727,10 +727,10 @@ export default defineComponent({ const promiseResult = await Promise.allSettled(requests) // promise.allSettled returns an array of result with status and value fields let resp = promiseResult.map((respone: any) => respone.value) as any - if (hasError(resp[0]) && resp[0]?.data?.error !== "No record found") showToast(this.$t("Something went wrong, could not fetch", { data: 'quantity on hand' })) + if (hasError(resp[0]) && resp[0]?.data?.error !== "No record found") showToast(translate("Something went wrong, could not fetch", { data: 'quantity on hand' })) else this.atpCalcDetails.totalQOH = resp[0].data?.quantityOnHandTotal - if (hasError(resp[1]) && resp[1]?.data?.error !== "No record found") showToast(this.$t("Something went wrong, could not fetch", { data: 'online ATP' })) + if (hasError(resp[1]) && resp[1]?.data?.error !== "No record found") showToast(translate("Something went wrong, could not fetch", { data: 'online ATP' })) else this.atpCalcDetails.onlineAtp = resp[1].data?.onlineAtp if (typeof resp[0].data?.availableToPromiseTotal === 'number' && typeof this.atpCalcDetails.onlineAtp === 'number') { @@ -872,45 +872,45 @@ export default defineComponent({ if (this.poSummary.eligible && hasCategory) { const categoryName = hasPreOrderCategory ? 'pre-order' : 'back-order'; if (this.poAndAtpDetails.activePoFromDate) { - this.poSummary.header = this.$t("Added to at", { categoryName, addedDateTime: this.getDateTime(this.poAndAtpDetails.activePoFromDate) }); + this.poSummary.header = translate("Added to at", { categoryName, addedDateTime: this.getDateTime(this.poAndAtpDetails.activePoFromDate) }); } else { - this.poSummary.header = this.$t("Added to", { categoryName }); + this.poSummary.header = translate("Added to", { categoryName }); } - this.poSummary.body = this.$t("When this product entered there was no sellable inventory and was available in", { categoryName, poItemATP: this.poAndAtpDetails.activePo.quantity , poId: this.poAndAtpDetails.activePo.orderExternalId ? this.poAndAtpDetails.activePo.orderExternalId : this.poAndAtpDetails.activePo.orderId }); + this.poSummary.body = translate("When this product entered there was no sellable inventory and was available in", { categoryName, poItemATP: this.poAndAtpDetails.activePo.quantity , poId: this.poAndAtpDetails.activePo.orderExternalId ? this.poAndAtpDetails.activePo.orderExternalId : this.poAndAtpDetails.activePo.orderId }); } else if (!this.poSummary.eligible && !hasCategory) { const presellingJob = this.getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT'); if (Object.keys(presellingJob).length === 0 || !presellingJob.runTime) { - this.poSummary.header = this.$t("Pre-sell processing disabled"); + this.poSummary.header = translate("Pre-sell processing disabled"); } else { - this.poSummary.header = this.$t("Preselling processed at", { processingDateTime: this.getDateTime(presellingJob.runTime) }); + this.poSummary.header = translate("Preselling processed at", { processingDateTime: this.getDateTime(presellingJob.runTime) }); } if (this.atpCalcDetails.onlineAtp > 0) { - this.poSummary.body = this.$t("This product is not preselling because it is in stock."); + this.poSummary.body = translate("This product is not preselling because it is in stock."); } else { - this.poSummary.body = this.$t("This product is not preselling because there is no active PO available for it."); + this.poSummary.body = translate("This product is not preselling because there is no active PO available for it."); } } else if (this.poSummary.eligible && !hasCategory) { const categoryName = this.poAndAtpDetails.activePo?.isNewProduct === "Y" ? 'pre-order' : 'back-order'; const presellingJob = this.getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT'); if (Object.keys(presellingJob).length === 0 || !presellingJob.runTime) { - this.poSummary.header = this.$t("Pre-sell processing disabled"); + this.poSummary.header = translate("Pre-sell processing disabled"); } else { - this.poSummary.header = this.$t("Adding to", { categoryName, addingTime: this.timeTillJob(presellingJob.runTime) }); + this.poSummary.header = translate("Adding to", { categoryName, addingTime: this.timeTillJob(presellingJob.runTime) }); } - this.poSummary.body = this.$t("This product will begin pre-selling because it is out of stock and purchase order is available.", { poId: this.poAndAtpDetails.activePo.orderExternalId ? this.poAndAtpDetails.activePo.orderExternalId : this.poAndAtpDetails.activePo.orderId }); + this.poSummary.body = translate("This product will begin pre-selling because it is out of stock and purchase order is available.", { poId: this.poAndAtpDetails.activePo.orderExternalId ? this.poAndAtpDetails.activePo.orderExternalId : this.poAndAtpDetails.activePo.orderId }); } else if (!this.poSummary.eligible && hasCategory) { const categoryName = hasPreOrderCategory ? 'pre-order' : 'back-order'; const presellingJob = this.getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT'); if (Object.keys(presellingJob).length === 0 || !presellingJob.runTime) { - this.poSummary.header = this.$t("Pre-sell processing disabled"); + this.poSummary.header = translate("Pre-sell processing disabled"); } else { const headerMessage = this.isPastTime(presellingJob.runTime) ? "Removed from" : "Removing from"; - this.poSummary.header = this.$t(headerMessage, { categoryName, removeTime: this.timeTillJob(presellingJob.runTime) }); + this.poSummary.header = translate(headerMessage, { categoryName, removeTime: this.timeTillJob(presellingJob.runTime) }); } if (this.atpCalcDetails.onlineAtp > 0) { - this.poSummary.body = this.$t("This product will be removed from because it is in stock", { categoryName }); + this.poSummary.body = translate("This product will be removed from because it is in stock", { categoryName }); } else { - this.poSummary.body = this.$t("This product will be removed from because it doesn’t have active purchase orders", { categoryName }); + this.poSummary.body = translate("This product will be removed from because it doesn’t have active purchase orders", { categoryName }); } } @@ -944,17 +944,17 @@ export default defineComponent({ // Checking if we have the data const shopListingsWithMissingData = shopListings.filter((shopifyListing: any) => !shopifyListing.status) if (shopListingsWithMissingData.length === shopListings.length) { - this.poSummary.listingCountStatusMessage = this.$t("Listing data not available") + this.poSummary.listingCountStatusMessage = translate("Listing data not available") } else if (shopListingsWithMissingData.length > 0) { - this.poSummary.listingCountStatusMessage = this.$t("Some listing data not available") + this.poSummary.listingCountStatusMessage = translate("Some listing data not available") } else if (!this.poSummary.listedCount) { - this.poSummary.listingCountStatusMessage = this.$t("Not listed on any stores") + this.poSummary.listingCountStatusMessage = translate("Not listed on any stores") } else if (shopListings.length === this.poSummary.listedCount) { - this.poSummary.listingCountStatusMessage = this.$t("Listed on all stores") + this.poSummary.listingCountStatusMessage = translate("Listed on all stores") } else if (shopListings.length > this.poSummary.listedCount) { this.poSummary.eligible - ? this.poSummary.listingCountStatusMessage = this.$t("Not listed on store(s)", { count: this.configsByStores.length - this.poSummary.listedCount }) - : this.poSummary.listingCountStatusMessage = this.$t("Listed on store(s)", { count: this.poSummary.listedCount }) + ? this.poSummary.listingCountStatusMessage = translate("Not listed on store(s)", { count: this.configsByStores.length - this.poSummary.listedCount }) + : this.poSummary.listingCountStatusMessage = translate("Listed on store(s)", { count: this.poSummary.listedCount }) } // Get the first record with promise date const shopListingWithPromiseDate = shopListings.find((shopifyListing: any) => shopifyListing.status === 'active' && shopifyListing.promiseDate) @@ -1063,20 +1063,20 @@ export default defineComponent({ if (!listData.containsError) { if (listData.status === 'inactive') { // showing the job's runTime as listing time, and not showing listing time if not present - listingTime && (listData.listingTimeAndStatus = this.$t("Delisted at", { listingTime })) + listingTime && (listData.listingTimeAndStatus = translate("Delisted at", { listingTime })) listData.listingStatus = 'Not listed' } else { - listingTime && (listData.listingTimeAndStatus = this.$t("Listed at", { listingTime })) + listingTime && (listData.listingTimeAndStatus = translate("Listed at", { listingTime })) listData.listingStatus = 'Listed' } } else { // If it failed to update, considered the status must old if (listData.status === 'inactive') { // showing the job's runTime as listing time - listingTime && (listData.listingTimeAndStatus = this.$t("Delisting failed at", { listingTime })) + listingTime && (listData.listingTimeAndStatus = translate("Delisting failed at", { listingTime })) listData.listingStatus = 'Listed' } else { - listingTime && (listData.listingTimeAndStatus = this.$t("Listing failed at", { listingTime })) + listingTime && (listData.listingTimeAndStatus = translate("Listing failed at", { listingTime })) listData.listingStatus = 'Not listed' } } @@ -1110,7 +1110,7 @@ export default defineComponent({ await Clipboard.write({ string: auditMsg }).then(() => { - showToast(this.$t("Copied to clipboard")); + showToast(translate("Copied to clipboard")); }) }, getSortedShopListings(shopListings: any) { @@ -1131,7 +1131,8 @@ export default defineComponent({ hasPermission, router, shirtOutline, - store + store, + translate }; }, }); diff --git a/src/views/catalog.vue b/src/views/catalog.vue index fa00d4538..3379ffe72 100644 --- a/src/views/catalog.vue +++ b/src/views/catalog.vue @@ -5,7 +5,7 @@ - {{ $t("Catalog") }} + {{ translate("Catalog") }} @@ -13,11 +13,11 @@
- + - {{ $t(filter.name) }} + {{ translate(filter.name) }} @@ -25,15 +25,15 @@
- {{ $t('Jobs') }} + {{ translate('Jobs') }} -
{{ $t('Pre-sell computation') }}
+
{{ translate('Pre-sell computation') }}

{{ preordBckordComputationJob.lastRunTime && timeTillJob(preordBckordComputationJob.lastRunTime) }}

-

{{ preordBckordComputationJob.runTime ? timeTillJob(preordBckordComputationJob.runTime) : $t('disabled')}}

+

{{ preordBckordComputationJob.runTime ? timeTillJob(preordBckordComputationJob.runTime) : translate('disabled')}}

@@ -43,7 +43,7 @@
- {{ $t('No products found') }} + {{ translate('No products found') }}
@@ -58,27 +58,27 @@ - {{ product.prodCatalogCategoryTypeIds.includes('PCCT_PREORDR') ? $t('Pre-order') : product.prodCatalogCategoryTypeIds.includes('PCCT_BACKORDER') ? $t('Back-order') : '-' }} + {{ product.prodCatalogCategoryTypeIds.includes('PCCT_PREORDR') ? translate('Pre-order') : product.prodCatalogCategoryTypeIds.includes('PCCT_BACKORDER') ? translate('Back-order') : '-' }}
- +
@@ -114,6 +114,7 @@ import { mapGetters } from 'vuex'; import { DateTime } from 'luxon'; import { JobService } from '@/services/JobService'; import { hasError } from '@/utils'; +import { translate } from '@hotwax/dxp-components'; export default defineComponent({ name: 'Catalog', @@ -277,6 +278,7 @@ export default defineComponent({ return { router, store, + translate }; }, }); diff --git a/src/views/edit-shipping-modal.vue b/src/views/edit-shipping-modal.vue index b8dc7f2ac..13227b525 100644 --- a/src/views/edit-shipping-modal.vue +++ b/src/views/edit-shipping-modal.vue @@ -6,7 +6,7 @@ - {{ $t("Edit shipping date") }} + {{ translate("Edit shipping date") }} @@ -14,29 +14,29 @@ - {{ $t("Custom") }} + {{ translate("Custom") }} - {{ $t("Ships from date") }} + {{ translate("Ships from date") }} - {{ $t("Auto") }} + {{ translate("Auto") }} - {{ $t("Purchase orders") }} + {{ translate("Purchase orders") }} 12345 -

{{ $t("ATP") }}: 30

+

{{ translate("ATP") }}: 30

12 Feb 2021
@@ -44,7 +44,7 @@ 67890 -

{{ $t("ATP") }}: 50

+

{{ translate("ATP") }}: 50

12 Feb 2021
@@ -81,6 +81,7 @@ import { } from '@ionic/vue'; import { defineComponent } from 'vue'; import { closeOutline, saveOutline } from 'ionicons/icons'; +import { translate } from '@hotwax/dxp-components'; export default defineComponent({ name: 'EditShippingModal', @@ -112,6 +113,7 @@ export default defineComponent({ return { closeOutline, saveOutline, + translate }; }, }); diff --git a/src/views/job-actions-popover.vue b/src/views/job-actions-popover.vue index 4cab508c9..b282bb0e9 100644 --- a/src/views/job-actions-popover.vue +++ b/src/views/job-actions-popover.vue @@ -4,21 +4,21 @@ - {{ $t("Schedule in every 15 minutes") }} + {{ translate("Schedule in every 15 minutes") }} - {{ $t("Run now") }} + {{ translate("Run now") }} - {{ $t("History") }} + {{ translate("History") }} - {{ $t("Cancel job") }} + {{ translate("Cancel job") }} @@ -45,7 +45,7 @@ import { useStore } from "@/store"; import JobHistoryModal from "./job-history-modal.vue"; import { JobService } from "@/services/JobService"; import { hasError, showToast } from "@/utils"; -import { translate } from "@/i18n"; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "JobActionsPopover", @@ -101,14 +101,14 @@ export default defineComponent({ }, async confirmJobCancellation() { const alert = await alertController.create({ - header: this.$t("Cancel job"), - message: this.$t("The job is currently in progress. Are you sure that you want to cancel this job?"), + header: translate("Cancel job"), + message: translate("The job is currently in progress. Are you sure that you want to cancel this job?"), buttons: [{ - text: this.$t('No'), + text: translate('No'), role: 'cancel', }, { - text: this.$t('Yes'), + text: translate('Yes'), handler: async () => { this.cancelJob() } @@ -140,7 +140,8 @@ export default defineComponent({ flashOutline, store, timeOutline, - timerOutline + timerOutline, + translate } } }); diff --git a/src/views/job-history-modal.vue b/src/views/job-history-modal.vue index 568e6c5c9..f6bfaefa6 100644 --- a/src/views/job-history-modal.vue +++ b/src/views/job-history-modal.vue @@ -12,7 +12,7 @@
-

{{ $t("No jobs have run yet")}}

+

{{ translate("No jobs have run yet")}}

@@ -50,6 +50,7 @@ import { mapGetters, useStore } from 'vuex'; import { DateTime } from 'luxon'; import { JobService } from '@/services/JobService' import { hasError } from '@/utils'; +import { translate } from '@hotwax/dxp-components'; export default defineComponent({ name: 'JobHistoryModal', @@ -123,7 +124,8 @@ export default defineComponent({ return { closeOutline, - store + store, + translate }; }, }); diff --git a/src/views/order-popover.vue b/src/views/order-popover.vue index a17073d36..4d253c4ec 100644 --- a/src/views/order-popover.vue +++ b/src/views/order-popover.vue @@ -1,10 +1,10 @@ @@ -22,6 +22,7 @@ import { defineComponent } from "vue"; import WarehouseModal from "@/views/warehouse-modal.vue"; import { useStore } from "@/store"; import PromiseDateModal from "@/views/promise-date-modal.vue"; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "OrderPopover", @@ -46,20 +47,20 @@ export default defineComponent({ }, releaseAlert: async function () { const alert = await alertController.create({ - header: this.$t("Release item"), + header: translate("Release item"), cssClass: "alert-message", - message: this.$t( + message: translate( 'This item will be automatically brokered and assigned for fulfillment.' ), buttons: [ { - text: this.$t("Cancel"), + text: translate("Cancel"), role: 'cancel', cssClass: 'secondary' }, { - text: this.$t("Release"), + text: translate("Release"), handler: () => { this.releaseItem(this.item).then(() => { this.store.dispatch("order/removeItem", { item: this.item }); @@ -97,18 +98,18 @@ export default defineComponent({ }, async cancelAlert() { const alert = await alertController.create({ - header: this.$t("Cancel item"), - message: this.$t( + header: translate("Cancel item"), + message: translate( 'This item will be cancelled. This action cannot be undone.' ), buttons: [ { - text: this.$t("Don't cancel"), + text: translate("Don't cancel"), role: 'cancel', cssClass: 'secondary' }, { - text: this.$t( "Confirm"), + text: translate( "Confirm"), handler: () => { this.cancelItem(this.item).then(() => { this.store.dispatch("order/removeItem", { item: this.item }) @@ -125,7 +126,8 @@ export default defineComponent({ setup() { const store = useStore(); return { - store + store, + translate } }, components: { diff --git a/src/views/orders.vue b/src/views/orders.vue index 1ddc6b307..8360884b6 100644 --- a/src/views/orders.vue +++ b/src/views/orders.vue @@ -5,10 +5,10 @@ - {{ $t("Orders") }} + {{ translate("Orders") }} - {{ selectedItemsCount}} {{ $t("item selected")}} + {{ selectedItemsCount}} {{ translate("item selected")}} @@ -26,7 +26,7 @@
- {{ $t("Ordered after") }} + {{ translate("Ordered after") }}
-

{{ $t("No results found")}}

-

{{ $t("Enter an order ID, product name, style name, SKU, customer name, UPCA or external ID")}}

+

{{ translate("No results found")}}

+

{{ translate("Enter an order ID, product name, style name, SKU, customer name, UPCA or external ID")}}

@@ -108,7 +108,7 @@
@@ -121,21 +121,21 @@

{{ item.parentProductName ? item.parentProductName :item.productName }}

-

{{ $t("Color") }} : {{ $filters.getFeature(getProduct(item.productId).featureHierarchy, '1/COLOR/') }}

-

{{ $t("Size") }} : {{ $filters.getFeature(getProduct(item.productId).featureHierarchy, '1/SIZE/') }}

+

{{ translate("Color") }} : {{ $filters.getFeature(getProduct(item.productId).featureHierarchy, '1/COLOR/') }}

+

{{ translate("Size") }} : {{ $filters.getFeature(getProduct(item.productId).featureHierarchy, '1/SIZE/') }}

- {{ $t ("Available to promise") }} + {{ translate ("Available to promise") }}

{{ getProductStock(item.productId) }}

- {{ $t("Promised date") }} + {{ translate("Promised date") }}

{{ item.promisedDatetime ? $filters.formatUtcDate(item.promisedDatetime, "yyyy-MM-dd'T'HH:mm:ss'Z'") : '-' }}

- {{$t("Select item")}} + {{translate("Select item")}} @@ -145,7 +145,7 @@
- +
@@ -154,16 +154,16 @@ - {{ $t("Release") }} + {{ translate("Release") }} - {{ $t("Release to a warehouse") }} + {{ translate("Release to a warehouse") }} - {{ $t("Edit promise date") }} + {{ translate("Edit promise date") }} - {{ $t("Cancel") }} + {{ translate("Cancel") }} @@ -224,6 +224,7 @@ import { showToast } from '@/utils' import { Plugins } from '@capacitor/core'; import { DxpShopifyImg } from "@hotwax/dxp-components"; import emitter from "@/event-bus"; +import { translate } from "@hotwax/dxp-components"; const { Clipboard } = Plugins; @@ -334,16 +335,16 @@ export default defineComponent({ }, async deselectAlert() { const alert = await alertController.create({ - header: this.$t("Deselect items"), - message: this.$t('Deselect the selected order items', { count: this.selectedItems.length }), + header: translate("Deselect items"), + message: translate('Deselect the selected order items', { count: this.selectedItems.length }), buttons: [ { - text: this.$t("Cancel"), + text: translate("Cancel"), role: 'cancel', cssClass: 'secondary' }, { - text: this.$t("Deselect"), + text: translate("Deselect"), handler: () => { this.deselectSelectedItems(); }, @@ -353,21 +354,21 @@ export default defineComponent({ return alert.present(); }, async releaseAlert() { - const message = (this.jobTotal > 0 ? (this.jobTotal === 1 ? this.$t("There is a job already pending.") : this.$t("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + this.$t( + const message = (this.jobTotal > 0 ? (this.jobTotal === 1 ? translate("There is a job already pending.") : translate("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + translate( 'preorders will be automatically brokered and assigned for fulfillment.', { count: this.selectedItems.length } ); const alert = await alertController.create({ - header: this.$t("Release orders"), + header: translate("Release orders"), cssClass: "alert-message", message, buttons: [ { - text: this.$t('Cancel'), + text: translate('Cancel'), role: 'cancel', cssClass: 'secondary' }, { - text:this.$t('Release'), + text:translate('Release'), handler: () => { this.releaseItems(); @@ -378,20 +379,20 @@ export default defineComponent({ return alert.present(); }, async cancelAlert() { - const message = (this.jobTotal > 0 ? (this.jobTotal === 1 ? this.$t("There is a job already pending.") : this.$t("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + this.$t( + const message = (this.jobTotal > 0 ? (this.jobTotal === 1 ? translate("There is a job already pending.") : translate("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + translate( 'preorders will be cancelled. This action cannot be undone.',{ count: this.selectedItems.length } ) const alert = await alertController.create({ - header:this.$t("Cancel orders"), + header:translate("Cancel orders"), message, buttons: [ { - text: this.$t("Don't cancel"), + text: translate("Don't cancel"), role: 'cancel', cssClass: 'secondary' }, { - text: this.$t("Confirm"), + text: translate("Confirm"), handler: () => { this.cancelItems(); }, @@ -464,7 +465,7 @@ export default defineComponent({ await Clipboard.write({ string: text }).then(() => { - showToast(this.$t('Copied', { text })); + showToast(translate('Copied', { text })); }) }, selectSearchBarText(event: any) { @@ -486,6 +487,7 @@ export default defineComponent({ closeCircle, hourglass, close, + translate }; }, }); diff --git a/src/views/product-details.vue b/src/views/product-details.vue index 471f13f67..95a050c9d 100644 --- a/src/views/product-details.vue +++ b/src/views/product-details.vue @@ -5,7 +5,7 @@ - {{ $t("Product details") }} + {{ translate("Product details") }} @@ -30,7 +30,7 @@
- {{ $t("Colors") }} + {{ translate("Colors") }} {{ colorFeature }} @@ -38,7 +38,7 @@ - {{ $t("Sizes") }} + {{ translate("Sizes") }} {{ sizeFeature }} @@ -50,28 +50,28 @@
- {{ $t("Ordered after") }} + {{ translate("Ordered after") }} - {{ $t("Ordered before") }} + {{ translate("Ordered before") }} - {{ $t("Promised after") }} + {{ translate("Promised after") }} - {{ $t("Promised before") }} + {{ translate("Promised before") }} @@ -79,24 +79,24 @@ - {{ $t("Loyalty status") }} + {{ translate("Loyalty status") }} - + {{key}} - {{ $t("Only orders without promise date") }} + {{ translate("Only orders without promise date") }}
@@ -105,8 +105,8 @@
- {{ current.totalPreOrders }} {{ $t("pieces preordered") }} - {{ current.list.items.length ? current.list.items.length : 0 }} {{ current.list.items.length > 1 ? $t("variants") : $t("variant") }} + {{ current.totalPreOrders }} {{ translate("pieces preordered") }} + {{ current.list.items.length ? current.list.items.length : 0 }} {{ current.list.items.length > 1 ? translate("variants") : translate("variant") }} @@ -115,7 +115,7 @@
-

{{ $t("There are no preorders for the filters you have applied and variants you have selected.")}}

+

{{ translate("There are no preorders for the filters you have applied and variants you have selected.")}}

@@ -128,19 +128,19 @@

{{ getProduct(item.groupValue).productName }}

-

{{ $t("Color") }}: {{ $filters.getFeature(getProduct(item.groupValue).featureHierarchy, '1/COLOR/') }}

-

{{ $t("Size") }}: {{ $filters.getFeature(getProduct(item.groupValue).featureHierarchy, '1/SIZE/') }}

+

{{ translate("Color") }}: {{ $filters.getFeature(getProduct(item.groupValue).featureHierarchy, '1/COLOR/') }}

+

{{ translate("Size") }}: {{ $filters.getFeature(getProduct(item.groupValue).featureHierarchy, '1/SIZE/') }}

- {{ item.doclist && item.doclist.numFound ? item.doclist.numFound : 0 }} {{ $t("pieces preordered") }} - {{ getProductStock(item.groupValue) }} {{ $t("in stock") }} - {{ getBrokeringCountByProduct(item.groupValue) }} {{ $t("in brokering") }} + {{ item.doclist && item.doclist.numFound ? item.doclist.numFound : 0 }} {{ translate("pieces preordered") }} + {{ getProductStock(item.groupValue) }} {{ translate("in stock") }} + {{ getBrokeringCountByProduct(item.groupValue) }} {{ translate("in brokering") }}
- {{ $t("Pieces") }} + {{ translate("Pieces") }}
@@ -152,13 +152,13 @@ - {{ $t("Release") }} + {{ translate("Release") }} - {{ $t("Release to a warehouse") }} + {{ translate("Release to a warehouse") }} - {{ $t("Cancel") }} + {{ translate("Cancel") }} @@ -217,6 +217,7 @@ import { DxpShopifyImg } from "@hotwax/dxp-components"; import { sizeIndex } from "@/apparel-sorter" import { DateTime } from 'luxon'; import emitter from "@/event-bus"; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "product-details", @@ -343,11 +344,11 @@ export default defineComponent({ }, async infoAlert() { const alert = await alertController.create({ - header: this.$t("How are orders released?"), - message: this.$t( - "Orders are released from oldest to newest. Use the Date filter to identify orders taken before a certain date.")+"

"+ this.$t("The order count in product cards will be updated based on the filters you select.")+"

" + header: translate("How are orders released?"), + message: translate( + "Orders are released from oldest to newest. Use the Date filter to identify orders taken before a certain date.")+"

"+ translate("The order count in product cards will be updated based on the filters you select.")+"

" , - buttons: [this.$t("Dismiss")], + buttons: [translate("Dismiss")], }); return alert.present(); @@ -358,21 +359,21 @@ export default defineComponent({ // When using clear input the value is reset to '' and results to NaN when added without check return selectedVariantsCount ? count + parseInt(selectedVariantsCount) : count; }, 0) - const message = (this.jobTotal > 0 ? (this.jobTotal === 1 ? this.$t("There is a job already pending.") : this.$t("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + this.$t( + const message = (this.jobTotal > 0 ? (this.jobTotal === 1 ? translate("There is a job already pending.") : translate("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + translate( 'preorders will be automatically brokered and assigned for fulfillment.',{ count: itemCount } ) const alert = await alertController.create({ - header: this.$t("Release orders"), + header: translate("Release orders"), cssClass: "alert-message", message, buttons: [ { - text: this.$t('Cancel'), + text: translate('Cancel'), role: 'cancel', cssClass: 'secondary' }, { - text:this.$t('Release'), + text:translate('Release'), handler: () => { this.releaseItems(); }, @@ -387,20 +388,20 @@ export default defineComponent({ // When using clear input the value is reset to '' and results to NaN when added without check return selectedVariantsCount ? count + parseInt(selectedVariantsCount) : count; }, 0) - const message = (this.jobTotal > 0 ? (this.jobTotal === 1 ? this.$t("There is a job already pending.") : this.$t("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + this.$t( + const message = (this.jobTotal > 0 ? (this.jobTotal === 1 ? translate("There is a job already pending.") : translate("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + translate( 'preorders will be cancelled. This action cannot be undone.',{ count: itemCount } ) const alert = await alertController.create({ - header: this.$t("Cancel orders"), + header: translate("Cancel orders"), message, buttons: [ { - text: this.$t("Don't cancel"), + text: translate("Don't cancel"), role: 'cancel', cssClass: 'secondary' }, { - text: this.$t("Confirm"), + text: translate("Confirm"), handler: () => { this.cancelItems(); }, @@ -587,7 +588,8 @@ export default defineComponent({ list, ribbon, refresh, - store + store, + translate }; }, }); diff --git a/src/views/products.vue b/src/views/products.vue index 22636b5c1..ecb8ce322 100644 --- a/src/views/products.vue +++ b/src/views/products.vue @@ -5,7 +5,7 @@ - {{ $t("Products") }} + {{ translate("Products") }} @@ -15,14 +15,14 @@ - +
-

{{ $t("No results found")}}

+

{{ translate("No results found")}}

-

{{ $t("Enter a product name, style name, SKU, UPCA or external ID.")}}

+

{{ translate("Enter a product name, style name, SKU, UPCA or external ID.")}}

@@ -35,11 +35,11 @@

{{ getProduct(product.groupValue).productName}}

{{ feature }}: {{ attribute }}

- {{ product.doclist.numFound }} {{ $t("pieces preordered") }} + {{ product.doclist.numFound }} {{ translate("pieces preordered") }}
- +
@@ -73,6 +73,7 @@ import BackgroundJobModal from "./background-job-modal.vue"; import { useStore } from "@/store"; import { mapGetters } from "vuex"; import { DxpShopifyImg } from "@hotwax/dxp-components"; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "settings", @@ -163,6 +164,7 @@ export default defineComponent({ router, store, hourglass, + translate }; }, }); diff --git a/src/views/promise-date-modal.vue b/src/views/promise-date-modal.vue index a51ed4b9d..c0c733c4c 100644 --- a/src/views/promise-date-modal.vue +++ b/src/views/promise-date-modal.vue @@ -4,17 +4,17 @@ - {{ $t("Edit promise date") }} + {{ translate("Edit promise date") }} -

{{ $t("Select a new promise date for these orders. This new date will be used for allocating inventory and fulfilling these orders.")}}

+

{{ translate("Select a new promise date for these orders. This new date will be used for allocating inventory and fulfilling these orders.")}}

- {{ $t("Promised date") }} - + {{ translate("Promised date") }} + @@ -47,6 +47,7 @@ import { closeOutline, calendar, save} from "ionicons/icons"; import { useStore } from "@/store"; import { DateTime } from 'luxon' import { mapGetters } from "vuex"; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "PromiseDateModal", @@ -66,16 +67,16 @@ export default defineComponent({ }, async saveAlert() { const alert = await alertController.create({ - header: this.$t("Update promise date"), - message: this.$t( + header: translate("Update promise date"), + message: translate( "Are you sure you want to update the promise date for these orders?" ), buttons: [ { - text: this.$t("Cancel"), + text: translate("Cancel"), }, { - text: this.$t("Confirm"), + text: translate("Confirm"), handler: () => { (this.item ? this.updatePromisedDateItem() : this.updatePromiseDateItems()).then(() => { this.closeModal() @@ -123,7 +124,8 @@ export default defineComponent({ closeOutline, calendar, save, - store + store, + translate }; }, components: { diff --git a/src/views/settings.vue b/src/views/settings.vue index 42e017740..fb3256bdc 100644 --- a/src/views/settings.vue +++ b/src/views/settings.vue @@ -5,7 +5,7 @@ - {{ $t("Settings") }} + {{ translate("Settings") }} @@ -24,18 +24,18 @@ {{ userProfile.partyName }} - {{ $t("Logout") }} + {{ translate("Logout") }} - {{ $t("Go to Launchpad") }} + {{ translate("Go to Launchpad") }} - +
-

{{ $t('OMS') }}

+

{{ translate('OMS') }}

@@ -43,17 +43,17 @@ - {{ $t("Product Store") }} + {{ translate("Product Store") }} - {{ $t("Store") }} + {{ translate("Store") }} - {{ $t('A store represents a company or a unique catalog of products. If your OMS is connected to multiple eCommerce stores sellling different collections of products, you may have multiple Product Stores set up in HotWax Commerce.') }} + {{ translate('A store represents a company or a unique catalog of products. If your OMS is connected to multiple eCommerce stores sellling different collections of products, you may have multiple Product Stores set up in HotWax Commerce.') }} - {{ $t("Select store") }} + {{ translate("Select store") }} {{ store.storeName }} @@ -68,17 +68,17 @@ - {{ $t('Timezone') }} + {{ translate('Timezone') }} - {{ $t('The timezone you select is used to ensure automations you schedule are always accurate to the time you select.') }} + {{ translate('The timezone you select is used to ensure automations you schedule are always accurate to the time you select.') }} {{ userProfile && userProfile.userTimeZone ? userProfile.userTimeZone : '-' }} - {{ $t("Change") }} + {{ translate("Change") }}
@@ -114,6 +114,7 @@ import { defineComponent } from "vue"; import { mapGetters } from 'vuex' import TimeZoneModal from '@/views/timezone-modal.vue' import Image from '@/components/Image.vue'; +import { translate } from '@hotwax/dxp-components'; export default defineComponent({ name: "settings", @@ -141,7 +142,7 @@ export default defineComponent({ }, setup() { const store = useStore(); - return { store, codeWorkingOutline, timeOutline, globeOutline, personCircleOutline, openOutline, saveOutline } + return { store, codeWorkingOutline, timeOutline, globeOutline, personCircleOutline, openOutline, saveOutline, translate} }, data() { return { diff --git a/src/views/shipping-popover.vue b/src/views/shipping-popover.vue index 09adec768..5911b4e1e 100644 --- a/src/views/shipping-popover.vue +++ b/src/views/shipping-popover.vue @@ -2,7 +2,7 @@ SKU - {{ $t("Edit shipping date") }} + {{ translate("Edit shipping date") }} @@ -18,6 +18,7 @@ import { } from '@ionic/vue'; import { defineComponent } from 'vue'; import ShippingModal from '@/views/edit-shipping-modal.vue'; +import { translate } from '@hotwax/dxp-components'; export default defineComponent({ name: 'ShippingPopover', @@ -39,5 +40,10 @@ export default defineComponent({ IonList, IonListHeader, }, + setup(){ + return { + translate, + } + } }); \ No newline at end of file diff --git a/src/views/timezone-modal.vue b/src/views/timezone-modal.vue index 91fd3f414..b0682c258 100644 --- a/src/views/timezone-modal.vue +++ b/src/views/timezone-modal.vue @@ -6,10 +6,10 @@ - {{ $t("Select time zone") }} + {{ translate("Select time zone") }} - + @@ -18,11 +18,11 @@
- {{ $t("Fetching time zones") }} + {{ translate("Fetching time zones") }}
-

{{ $t("No time zone found") }}

+

{{ translate("No time zone found") }}

@@ -71,6 +71,7 @@ import { useStore } from "@/store"; import { UserService } from "@/services/UserService"; import { hasError } from '@/utils' import { DateTime } from 'luxon'; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "TimeZoneModal", @@ -106,16 +107,16 @@ export default defineComponent({ modalController.dismiss({ dismissed: true }); }, async saveAlert() { - const message = this.$t("Are you sure you want to change the time zone to?", { timeZoneId: this.timeZoneId }); + const message = translate("Are you sure you want to change the time zone to?", { timeZoneId: this.timeZoneId }); const alert = await alertController.create({ - header: this.$t("Update time zone"), + header: translate("Update time zone"), message, buttons: [ { - text: this.$t("Cancel"), + text: translate("Cancel"), }, { - text: this.$t("Confirm"), + text: translate("Confirm"), handler: () => { this.setUserTimeZone(); } @@ -165,7 +166,8 @@ export default defineComponent({ return { close, save, - store + store, + translate }; } }); diff --git a/src/views/warehouse-modal.vue b/src/views/warehouse-modal.vue index 839272748..aa26bdb04 100644 --- a/src/views/warehouse-modal.vue +++ b/src/views/warehouse-modal.vue @@ -6,17 +6,17 @@ - {{ $t("Release preorder to a warehouse") }} + {{ translate("Release preorder to a warehouse") }} - +
-

{{ $t("No warehouses found")}}

+

{{ translate("No warehouses found")}}

@@ -65,6 +65,7 @@ import { useStore } from "@/store"; import { ProductService } from '@/services/ProductService' import { mapGetters } from "vuex"; import emitter from "@/event-bus"; +import { translate } from "@hotwax/dxp-components"; export default defineComponent({ name: "WarehouseModal", @@ -89,20 +90,20 @@ export default defineComponent({ modalController.dismiss({ dismissed: true }); }, async saveAlert() { - const message = this.item ? this.$t( + const message = this.item ? translate( 'This item will be released to the warehouse you have selected.' - ) : (this.jobTotal > 0 ? (this.jobTotal === 1 ? this.$t("There is a job already pending.") : this.$t("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + this.$t( + ) : (this.jobTotal > 0 ? (this.jobTotal === 1 ? translate("There is a job already pending.") : translate("There are jobs already pending.", { count: this.jobTotal })) + " " : "") + translate( 'preorder items will be released to the warehouse you have selected.', { count: (this.selectedVariants ? this.variantItems : this.items).length } ); const alert = await alertController.create({ - header: this.$t("Release orders"), + header: translate("Release orders"), message, buttons: [ { - text: this.$t("Cancel"), + text: translate("Cancel"), }, { - text: this.$t("Confirm"), + text: translate("Confirm"), handler: () => { (this.item ? this.releaseItemToWarehouse() : this.releaseItemsToWarehouse()).then(() => { this.closeModal() @@ -215,7 +216,8 @@ export default defineComponent({ return { closeOutline, send, - store + store, + translate }; }, components: {