This commit is contained in:
Copilot 2025-11-07 16:16:47 +00:00 committed by GitHub
commit 8c63b76be4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13124 additions and 9997 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,18 @@ export function rootContainer(container: any) {
'en': require('./locales/en-US.json'),
'zh': require('./locales/zh-CN.json'),
};
let currentLocale = intl.determineLocale({
urlLocaleKey: 'lang',
cookieLocaleKey: 'lang',
localStorageLocaleKey: 'lang',
}).slice(0, 2);
let currentLocale: string;
try {
currentLocale = intl.determineLocale({
urlLocaleKey: 'lang',
cookieLocaleKey: 'lang',
localStorageLocaleKey: 'lang',
}).slice(0, 2);
} catch (e: unknown) {
// Handle decodeURIComponent errors from malformed cookies
console.warn('Failed to determine locale from cookies:', e);
currentLocale = '';
}
if (!currentLocale || !Object.keys(locales).includes(currentLocale)) {
currentLocale = 'zh';