1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-11-09 22:09:07 +01:00
.profile/i18n/i18n.ts
Théo LUDWIG 6b29ce9b15
feat: rewrite to Next.js v13 app directory
Improvements:
- Hide switch theme input (ugly little white square)
- i18n without subpath (e.g: /fr or /en), same url whatever the locale used
2023-07-31 19:06:46 +02:00

33 lines
853 B
TypeScript

import { I18n } from 'i18n-js'
import { DEFAULT_LOCALE, AVAILABLE_LOCALES } from '@/utils/constants'
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'
export const i18nOptions = {
defaultLocale: DEFAULT_LOCALE,
availableLocales: AVAILABLE_LOCALES.slice(),
enableFallback: true
}
export const i18n = new I18n(
{
'en-US': {
common: commonEnglish,
errors: errorsEnglish,
home: homeEnglish
},
'fr-FR': {
common: commonFrench,
errors: errorsFrench,
home: homeFrench
}
},
i18nOptions
)