Skip to content

Commit

Permalink
PWA-3294 :PLP should displayed on all store view
Browse files Browse the repository at this point in the history
  • Loading branch information
rudraswamy.c authored and rudraswamy.c committed Jun 28, 2024
1 parent 767d99e commit 1f15104
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion packages/venia-ui/lib/components/App/localeProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
4 changes: 2 additions & 2 deletions packages/venia-ui/lib/util/formatLocale.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @returns {string} A locale string (e.g. `fr_FR`).
*/
export const fromReactIntl = string => {
return string.replace('-', '_');
return string.replace(/-/g, '_');
};

/**
Expand All @@ -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, '-');
};

0 comments on commit 1f15104

Please sign in to comment.