refactor(i18n): add translation namespace to locale json instead of adding namespace in code
This commit is contained in:
+12
-14
@@ -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
|
||||
|
||||
+4567
-4565
File diff suppressed because it is too large
Load Diff
+4525
-4523
File diff suppressed because it is too large
Load Diff
+4508
-4506
File diff suppressed because it is too large
Load Diff
+4496
-4494
File diff suppressed because it is too large
Load Diff
+4475
-4473
File diff suppressed because it is too large
Load Diff
+4517
-4515
File diff suppressed because it is too large
Load Diff
+4503
-4501
File diff suppressed because it is too large
Load Diff
+4520
-4518
File diff suppressed because it is too large
Load Diff
+4489
-4487
File diff suppressed because it is too large
Load Diff
+4571
-4569
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user