Client - refactor locales

This commit is contained in:
Sam 2019-12-29 11:37:17 +01:00
parent 5869905b0c
commit 432bd0c27c
4 changed files with 43 additions and 34 deletions

View File

@ -2,20 +2,7 @@ import i18n from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import XHR from 'i18next-xhr-backend'
import EnActivitiesTranslations from './locales/en/activities.json'
import EnCommonTranslations from './locales/en/common.json'
import EnDashboardTranslations from './locales/en/dashboard.json'
import EnMessagesTranslations from './locales/en/messages.json'
import EnSportsTranslations from './locales/en/sports.json'
import EnStatisticsTranslations from './locales/en/statistics.json'
import EnUserTranslations from './locales/en/user.json'
import FrActivitiesTranslations from './locales/fr/activities.json'
import FrCommonTranslations from './locales/fr/common.json'
import FrDashboardTranslations from './locales/fr/dashboard.json'
import FrMessagesTranslations from './locales/fr/messages.json'
import FrSportsTranslations from './locales/fr/sports.json'
import FrStatisticsTranslations from './locales/fr/statistics.json'
import FrUserTranslations from './locales/fr/user.json'
import { resources } from './locales'
i18n
.use(XHR)
@ -28,26 +15,7 @@ i18n
interpolation: {
escapeValue: false,
},
resources: {
en: {
activities: EnActivitiesTranslations,
common: EnCommonTranslations,
dashboard: EnDashboardTranslations,
messages: EnMessagesTranslations,
sports: EnSportsTranslations,
statistics: EnStatisticsTranslations,
user: EnUserTranslations,
},
fr: {
activities: FrActivitiesTranslations,
common: FrCommonTranslations,
dashboard: FrDashboardTranslations,
messages: FrMessagesTranslations,
sports: FrSportsTranslations,
statistics: FrStatisticsTranslations,
user: FrUserTranslations,
},
},
resources,
ns: ['common'],
defaultNS: 'common',
})

View File

@ -0,0 +1,17 @@
import EnActivitiesTranslations from './activities.json'
import EnCommonTranslations from './common.json'
import EnDashboardTranslations from './dashboard.json'
import EnMessagesTranslations from './messages.json'
import EnSportsTranslations from './sports.json'
import EnStatisticsTranslations from './statistics.json'
import EnUserTranslations from './user.json'
export const enResources = {
activities: EnActivitiesTranslations,
common: EnCommonTranslations,
dashboard: EnDashboardTranslations,
messages: EnMessagesTranslations,
sports: EnSportsTranslations,
statistics: EnStatisticsTranslations,
user: EnUserTranslations,
}

View File

@ -0,0 +1,17 @@
import FrActivitiesTranslations from './activities.json'
import FrCommonTranslations from './common.json'
import FrDashboardTranslations from './dashboard.json'
import FrMessagesTranslations from './messages.json'
import FrSportsTranslations from './sports.json'
import FrStatisticsTranslations from './statistics.json'
import FrUserTranslations from './user.json'
export const frResources = {
activities: FrActivitiesTranslations,
common: FrCommonTranslations,
dashboard: FrDashboardTranslations,
messages: FrMessagesTranslations,
sports: FrSportsTranslations,
statistics: FrStatisticsTranslations,
user: FrUserTranslations,
}

View File

@ -0,0 +1,7 @@
import { enResources } from './en/resources'
import { frResources } from './fr/resources'
export const resources = {
en: enResources,
fr: frResources,
}