mirror of
https://github.com/whyour/qinglong.git
synced 2025-11-09 16:16:07 +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'),
|
'en': require('./locales/en-US.json'),
|
||||||
'zh': require('./locales/zh-CN.json'),
|
'zh': require('./locales/zh-CN.json'),
|
||||||
};
|
};
|
||||||
let currentLocale = intl.determineLocale({
|
let currentLocale: string;
|
||||||
urlLocaleKey: 'lang',
|
try {
|
||||||
cookieLocaleKey: 'lang',
|
currentLocale = intl.determineLocale({
|
||||||
localStorageLocaleKey: 'lang',
|
urlLocaleKey: 'lang',
|
||||||
}).slice(0, 2);
|
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)) {
|
if (!currentLocale || !Object.keys(locales).includes(currentLocale)) {
|
||||||
currentLocale = 'zh';
|
currentLocale = 'zh';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user