mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 18:50:56 +08:00
refactor(i18n): add translation namespace to locale json instead of adding namespace in code
This commit is contained in:
parent
311a229ab7
commit
cf0aa49427
@ -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')
|
||||
|
||||
@ -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
Loading…
Reference in New Issue
Block a user