Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/desktop/src/i18n/catalog.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ar } from './ar'
import { en } from './en'
import { ja } from './ja'
import { ru } from './ru'
import type { Locale, Translations } from './types'
import { zh } from './zh'
import { zhHant } from './zh-hant'
Expand All @@ -10,5 +11,6 @@ export const TRANSLATIONS: Record<Locale, Translations> = {
zh,
'zh-hant': zhHant,
ja,
ar
ar,
ru
}
7 changes: 7 additions & 0 deletions apps/desktop/src/i18n/languages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ describe('desktop i18n languages', () => {
expect(normalizeLocale('ar')).toBe('ar')
expect(normalizeLocale('AR-SA')).toBe('ar')
expect(normalizeLocale(' ar_eg ')).toBe('ar')
expect(normalizeLocale('ru')).toBe('ru')
expect(normalizeLocale('RU-RU')).toBe('ru')
expect(normalizeLocale(' ru_ru ')).toBe('ru')
expect(normalizeLocale('Русский')).toBe('ru')
})

it('falls back to English for empty or unsupported values', () => {
Expand All @@ -30,12 +34,14 @@ describe('desktop i18n languages', () => {
expect(isSupportedLocaleValue('zh-CN')).toBe(true)
expect(isSupportedLocaleValue('zh-TW')).toBe(true)
expect(isSupportedLocaleValue('ja-JP')).toBe(true)
expect(isSupportedLocaleValue('ru-RU')).toBe(true)
expect(isSupportedLocaleValue('de')).toBe(false)
expect(isLocale('zh-CN')).toBe(false)
expect(isLocale('zh')).toBe(true)
expect(isLocale('zh-hant')).toBe(true)
expect(isLocale('ja')).toBe(true)
expect(isLocale('ar')).toBe(true)
expect(isLocale('ru')).toBe(true)
})

it('returns the persisted config value for supported locales', () => {
Expand All @@ -44,5 +50,6 @@ describe('desktop i18n languages', () => {
expect(localeConfigValue('zh-hant')).toBe('zh-hant')
expect(localeConfigValue('ja')).toBe('ja')
expect(localeConfigValue('ar')).toBe('ar')
expect(localeConfigValue('ru')).toBe('ru')
})
})
17 changes: 16 additions & 1 deletion apps/desktop/src/i18n/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export const LOCALE_OPTIONS = [
name: 'العربية',
englishName: 'Arabic',
configValue: 'ar'
},
{
id: 'ru',
name: 'Русский',
englishName: 'Russian',
configValue: 'ru'
}
] as const satisfies readonly { configValue: string; englishName: string; id: Locale; name: string }[]

Expand Down Expand Up @@ -79,7 +85,16 @@ const LOCALE_ALIASES: Record<string, Locale> = {
'ar-eg': 'ar',
ar_eg: 'ar',
arabic: 'ar',
العربية: 'ar'
العربية: 'ar',
ru: 'ru',
'ru-ru': 'ru',
ru_ru: 'ru',
'ru-by': 'ru',
'ru-kz': 'ru',
russian: 'ru',
'russian-russian': 'ru',
русский: 'ru',
руский: 'ru'
}

export function isLocale(value: unknown): value is Locale {
Expand Down
Loading
Loading