mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-11-16 23:04:24 +08:00
feat(i18n): add Russian UI and harden localization
This commit is contained in:
+11
-2
@@ -17,7 +17,11 @@ function readCookie(name: string): string | null {
|
||||
.map((part) => part.trim())
|
||||
.find((part) => part.startsWith(`${name}=`));
|
||||
if (!match) return null;
|
||||
return decodeURIComponent(match.slice(name.length + 1));
|
||||
try {
|
||||
return decodeURIComponent(match.slice(name.length + 1));
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function getClientLocalePreference(): AppLocale | null {
|
||||
@@ -35,7 +39,12 @@ export function detectBrowserLocale(): AppLocale {
|
||||
: [navigator.language];
|
||||
for (const lang of languages) {
|
||||
const lower = (lang ?? '').toLowerCase();
|
||||
if (lower.startsWith('zh') || lower.startsWith('en')) {
|
||||
if (
|
||||
lower.startsWith('zh') ||
|
||||
lower.startsWith('en') ||
|
||||
lower === 'ru' ||
|
||||
lower.startsWith('ru-')
|
||||
) {
|
||||
return normalizeLocale(lang);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user