mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-19 15:31:04 +02:00
fix: PWA not working after CRA@5 update (#6012)
* fix: PWA not working after CRA@5 update * fix: fallback to default locale when fetch fails
This commit is contained in:
11
src/i18n.ts
11
src/i18n.ts
@@ -90,9 +90,14 @@ export const setLanguage = async (lang: Language) => {
|
||||
if (lang.code.startsWith(TEST_LANG_CODE)) {
|
||||
currentLangData = {};
|
||||
} else {
|
||||
currentLangData = await import(
|
||||
/* webpackChunkName: "locales/[request]" */ `./locales/${currentLang.code}.json`
|
||||
);
|
||||
try {
|
||||
currentLangData = await import(
|
||||
/* webpackChunkName: "locales/[request]" */ `./locales/${currentLang.code}.json`
|
||||
);
|
||||
} catch (error: any) {
|
||||
console.error(`Failed to load language ${lang.code}:`, error.message);
|
||||
currentLangData = fallbackLangData;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user