From 43b77fd63f272dfe1e6f99b50ef0ee3eae3361d9 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 4 Dec 2024 17:54:21 +0530 Subject: [PATCH] Implemented: locale support in the app(#106) Used the locale string from the order to be used in the app, as app does not have any functionality to change locale --- src/i18n/locales/en.json | 2 ++ src/i18n/locales/es.json | 2 ++ src/views/Order.vue | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 986b8fed..acd529c2 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -39,12 +39,14 @@ "Save changes": "Save changes", "Save shipping address": "Save shipping address", "Select pickup location": "Select pickup location", + "Shipping": "Shipping", "Shipping address": "Shipping address", "Showing pickup locations near": "Showing pickup locations near", "Something went wrong while fetching stores": "Something went wrong while fetching stores", "Something went wrong while fetching the order details": "Something went wrong while fetching the order details", "Settings": "Settings", "State": "State", + "Store pickup": "Store pickup", "Street": "Street", "Tracking code": "Tracking code", "Username": "Username", diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index 51366b62..0b7df9c5 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -39,12 +39,14 @@ "Save changes": "Guardar cambios", "Save shipping address": "Guardar dirección de envío", "Select pickup location": "Seleccionar ubicación de recogida", + "Shipping": "Envío", "Shipping address": "Dirección de envío", "Showing pickup locations near": "Mostrando ubicaciones de recogida cercanas a", "Something went wrong while fetching stores": "Algo salió mal al obtener las tiendas", "Something went wrong while fetching the order details": "Algo salió mal al obtener los detalles del pedido", "Settings": "Configuraciones", "State": "Estado", + "Store pickup": "Recogida en tienda", "Street": "Calle", "Tracking code": "Código de seguimiento", "Username": "Nombre de usuario", diff --git a/src/views/Order.vue b/src/views/Order.vue index 498d80f0..88fa4ba1 100644 --- a/src/views/Order.vue +++ b/src/views/Order.vue @@ -37,7 +37,7 @@ --> - {{ method.name }} + {{ $t(method.name) }} {{ $t("Add address") }} @@ -113,7 +113,7 @@ import { defineComponent } from "vue"; import { useRouter } from "vue-router"; import { mapGetters, useStore } from 'vuex' import { OrderService } from "@/services/OrderService"; -import { translate } from "@/i18n"; +import i18n, { translate } from "@/i18n"; import { hasError, showToast } from "@/utils"; import Image from "@/components/Image.vue"; import AddressModal from "@/views/AddressModal.vue"; @@ -212,6 +212,7 @@ export default defineComponent({ }); if (!hasError(resp) && resp.data.id) { order = resp.data; + i18n.global.locale = order.localeString || "en"; const productIds: any = new Set(); order.shipGroup = order.shipGroup.filter((group: any) => { if(group.facilityId === 'PICKUP_REJECTED') {