Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/main/i18n/main-i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const LAZY_LOCALE_LOADERS: Record<
es: () => import('../../renderer/src/i18n/locales/es.json'),
ja: () => import('../../renderer/src/i18n/locales/ja.json'),
ko: () => import('../../renderer/src/i18n/locales/ko.json'),
zh: () => import('../../renderer/src/i18n/locales/zh.json')
zh: () => import('../../renderer/src/i18n/locales/zh.json'),
'zh-TW': () => import('../../renderer/src/i18n/locales/zh-TW.json')
}

const lazyLocaleBackend: BackendModule = {
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/src/components/settings/appearance-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const getLanguageEntries = createLocalizedCatalog((): SettingsSearchEntry
...translateSearchKeyword('settings.appearance.language.system', 'System'),
...translateSearchKeyword('settings.appearance.language.english', 'English'),
...translateSearchKeyword('settings.appearance.language.chinese', '中文(简体)'),
...translateSearchKeyword('settings.appearance.language.chineseTraditional', '中文(繁體)'),
...translateSearchKeyword('settings.appearance.language.korean', '한국어'),
...translateSearchKeyword('settings.appearance.language.japanese', '日本語'),
...translateSearchKeyword('settings.appearance.language.spanish', 'Español'),
Expand All @@ -55,6 +56,8 @@ export const getLanguageEntries = createLocalizedCatalog((): SettingsSearchEntry
// switch to) their language whatever the current interface locale is.
'语言', // Chinese (Simplified)
'語言', // Chinese (Traditional)
'繁體', // Traditional Chinese script name
'简体', // Simplified Chinese script name
'언어', // Korean
'言語', // Japanese
'Idioma', // Spanish
Expand Down
15 changes: 8 additions & 7 deletions src/renderer/src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ import type { PluginLanguagePackRegistration } from '../../../shared/plugins/plu

export const i18n: I18nInstance = i18next.createInstance()

// Why: only the English catalog is bundled eagerly. The other four locales add
// ~2MB to the renderer's startup chunk (parsed on every launch) even though the
// app always boots in English and only switches after the persisted UI language
// loads. A lazy backend fetches each non-English catalog on demand, so any
// changeLanguage() call (UI switch or test) transparently loads its bundle
// instead of paying the parse cost at cold start.
// Why: only the English catalog is bundled eagerly. The other non-default
// locales add multiple MB to the renderer's startup chunk (parsed on every
// launch) even though the app always boots in English and only switches after
// the persisted UI language loads. A lazy backend fetches each non-English
// catalog on demand, so any changeLanguage() call (UI switch or test)
// transparently loads its bundle instead of paying the parse cost at cold start.
const NON_DEFAULT_LOCALE_LOADERS: Record<
Exclude<SupportedUiLocale, 'en'>,
() => Promise<{ default: Record<string, unknown> }>
> = {
es: () => import('./locales/es.json'),
ja: () => import('./locales/ja.json'),
ko: () => import('./locales/ko.json'),
zh: () => import('./locales/zh.json')
zh: () => import('./locales/zh.json'),
'zh-TW': () => import('./locales/zh-TW.json')
}

const lazyLocaleBackend: BackendModule = {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"system": "System",
"english": "English",
"chinese": "中文(简体)",
"chineseTraditional": "中文(繁體)",
"korean": "한국어",
"japanese": "日本語",
"spanish": "Español"
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"system": "Sistema",
"english": "Inglés",
"chinese": "中文(简体)",
"chineseTraditional": "中文(繁體)",
"korean": "한국어",
"japanese": "日本語",
"spanish": "Español"
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"system": "システム",
"english": "English",
"chinese": "中文(简体)",
"chineseTraditional": "中文(繁體)",
"korean": "한국어",
"japanese": "日本語",
"spanish": "Español"
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"system": "시스템",
"english": "English",
"chinese": "中文(简体)",
"chineseTraditional": "中文(繁體)",
"korean": "한국어",
"japanese": "日本語",
"spanish": "Español"
Expand Down
Loading