align locale theme across sites (#38)

This commit is contained in:
AceDataCloud committed 2024-05-11 09:39:35 +00:00
1 parent 9b8db40440
commit 266f2e8bb2
12 files changed
+124 -91

No files matched your search

+2 -2
View File
@@ -47,8 +47,8 @@ export const loadLocalResource = async (name: string, locale: string) => {
}
};
export const getLocale = (): string => {
const canonicalLang = Intl.getCanonicalLocales(navigator.language)?.[0];
export const getLocale = (lang?: string): string => {
const canonicalLang = Intl.getCanonicalLocales(lang || navigator.language)?.[0];
const supportedLocales = SUPPORTED_LOCALES.map((locale) => locale.value);
// if the canonical language is supported, use it
if (canonicalLang && supportedLocales.includes(canonicalLang)) {