2023-07-31 19:06:46 +02:00
|
|
|
import { I18n } from 'i18n-js'
|
|
|
|
|
2023-08-01 14:11:46 +02:00
|
|
|
import type { Locale } from '@/utils/constants'
|
|
|
|
import { DEFAULT_LOCALE, LOCALES } from '@/utils/constants'
|
2023-07-31 19:06:46 +02:00
|
|
|
|
|
|
|
import commonEnglish from './translations/en-US/common.json'
|
|
|
|
import errorsEnglish from './translations/en-US/errors.json'
|
|
|
|
import homeEnglish from './translations/en-US/home.json'
|
|
|
|
import commonFrench from './translations/fr-FR/common.json'
|
|
|
|
import errorsFrench from './translations/fr-FR/errors.json'
|
|
|
|
import homeFrench from './translations/fr-FR/home.json'
|
|
|
|
|
2023-08-01 14:11:46 +02:00
|
|
|
const translations = {
|
|
|
|
'en-US': {
|
|
|
|
common: commonEnglish,
|
|
|
|
errors: errorsEnglish,
|
|
|
|
home: homeEnglish
|
|
|
|
},
|
|
|
|
'fr-FR': {
|
|
|
|
common: commonFrench,
|
|
|
|
errors: errorsFrench,
|
|
|
|
home: homeFrench
|
|
|
|
}
|
|
|
|
} satisfies Record<Locale, Record<string, unknown>>
|
|
|
|
|
|
|
|
export const i18n = new I18n(translations, {
|
2023-07-31 19:06:46 +02:00
|
|
|
defaultLocale: DEFAULT_LOCALE,
|
2023-08-01 14:11:46 +02:00
|
|
|
availableLocales: LOCALES.slice(),
|
2023-07-31 19:06:46 +02:00
|
|
|
enableFallback: true
|
2023-08-01 14:11:46 +02:00
|
|
|
})
|