refactor(i18n): add translation namespace to locale json instead of adding namespace in code

This commit is contained in:
icarus 2025-10-23 13:31:12 +08:00
parent 311a229ab7
commit cf0aa49427
12 changed files with 45195 additions and 45179 deletions

View File

@ -15,20 +15,18 @@ import JaJP from '../../renderer/src/i18n/translate/ja-jp.json'
import ptPT from '../../renderer/src/i18n/translate/pt-pt.json'
import RuRu from '../../renderer/src/i18n/translate/ru-ru.json'
export const locales = Object.fromEntries(
[
['en-US', EnUs],
['zh-CN', ZhCn],
['zh-TW', ZhTw],
['ja-JP', JaJP],
['ru-RU', RuRu],
['de-DE', deDE],
['el-GR', elGR],
['es-ES', esES],
['fr-FR', frFR],
['pt-PT', ptPT]
].map(([locale, translation]) => [locale, { translation }])
)
const locales = Object.fromEntries([
['en-US', EnUs],
['zh-CN', ZhCn],
['zh-TW', ZhTw],
['ja-JP', JaJP],
['ru-RU', RuRu],
['de-DE', deDE],
['el-GR', elGR],
['es-ES', esES],
['fr-FR', frFR],
['pt-PT', ptPT]
])
export const getAppLanguage = (): LanguageVarious => {
const language = preferenceService.get('app.language')

View File

@ -19,20 +19,18 @@ import ruRU from './translate/ru-ru.json'
const logger = loggerService.withContext('I18N')
const resources = Object.fromEntries(
[
['en-US', enUS],
['ja-JP', jaJP],
['ru-RU', ruRU],
['zh-CN', zhCN],
['zh-TW', zhTW],
['de-DE', deDE],
['el-GR', elGR],
['es-ES', esES],
['fr-FR', frFR],
['pt-PT', ptPT]
].map(([locale, translation]) => [locale, { translation }])
)
const resources = Object.fromEntries([
['en-US', enUS],
['ja-JP', jaJP],
['ru-RU', ruRU],
['zh-CN', zhCN],
['zh-TW', zhTW],
['de-DE', deDE],
['el-GR', elGR],
['es-ES', esES],
['fr-FR', frFR],
['pt-PT', ptPT]
])
export const getLanguage = async () => {
return (await preferenceService.get('app.language')) || navigator.language || defaultLanguage

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff