From 1f1510460057f8dedff2379c3572254993d4d020 Mon Sep 17 00:00:00 2001 From: "rudraswamy.c" Date: Fri, 28 Jun 2024 11:31:06 +0530 Subject: [PATCH] PWA-3294 :PLP should displayed on all store view --- packages/venia-ui/lib/components/App/localeProvider.js | 9 ++++++++- packages/venia-ui/lib/util/formatLocale.js | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/venia-ui/lib/components/App/localeProvider.js b/packages/venia-ui/lib/components/App/localeProvider.js index 2bdcb7e19c..78737b950c 100644 --- a/packages/venia-ui/lib/components/App/localeProvider.js +++ b/packages/venia-ui/lib/components/App/localeProvider.js @@ -19,10 +19,17 @@ const LocaleProvider = props => { fetchPolicy: 'cache-and-network', nextFetchPolicy: 'cache-first' }); + let locale = data !== undefined ? data.storeConfig.locale : DEFAULT_LOCALE; + if (locale === 'zh_Hant_TW') { + locale = 'zh_TW'; + } + if (locale === 'zh_Hant_TW') { + locale = 'zh_TW'; + } const language = useMemo(() => { return data && data.storeConfig.locale - ? toReactIntl(data.storeConfig.locale) + ? toReactIntl(locale) : DEFAULT_LOCALE; }, [data]); diff --git a/packages/venia-ui/lib/util/formatLocale.js b/packages/venia-ui/lib/util/formatLocale.js index b10550af3b..c25786095c 100644 --- a/packages/venia-ui/lib/util/formatLocale.js +++ b/packages/venia-ui/lib/util/formatLocale.js @@ -5,7 +5,7 @@ * @returns {string} A locale string (e.g. `fr_FR`). */ export const fromReactIntl = string => { - return string.replace('-', '_'); + return string.replace(/-/g, '_'); }; /** @@ -15,5 +15,5 @@ export const fromReactIntl = string => { * @returns {string} A string (e.g. `fr-FR`). */ export const toReactIntl = string => { - return string.replace('_', '-'); + return string.replace(/_/g, '-'); };