mirror of
https://github.com/whyour/qinglong.git
synced 2025-11-08 15:06:08 +08:00
Merge 1f1dc84483 into 73f8f3c5fa
This commit is contained in:
commit
8c63b76be4
23104
pnpm-lock.yaml
23104
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
17
src/app.ts
17
src/app.ts
|
|
@ -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';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user