2023-10-23 23:11:59 +02:00
|
|
|
import { I18n } from "i18n-js"
|
2023-07-31 19:06:46 +02:00
|
|
|
|
2023-10-23 23:11:59 +02:00
|
|
|
import type { Locale } from "@/utils/constants"
|
|
|
|
import { DEFAULT_LOCALE, LOCALES } from "@/utils/constants"
|
2023-07-31 19:06:46 +02:00
|
|
|
|
2023-10-23 23:11:59 +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-07-31 19:06:46 +02:00
|
|
|
|
2023-08-01 14:11:46 +02:00
|
|
|
const translations = {
|
2023-10-23 23:11:59 +02:00
|
|
|
"en-US": {
|
2023-08-01 14:11:46 +02:00
|
|
|
common: commonEnglish,
|
|
|
|
errors: errorsEnglish,
|
2023-10-23 23:11:59 +02:00
|
|
|
home: homeEnglish,
|
2023-08-01 14:11:46 +02:00
|
|
|
},
|
2023-10-23 23:11:59 +02:00
|
|
|
"fr-FR": {
|
2023-08-01 14:11:46 +02:00
|
|
|
common: commonFrench,
|
|
|
|
errors: errorsFrench,
|
2023-10-23 23:11:59 +02:00
|
|
|
home: homeFrench,
|
|
|
|
},
|
2023-08-01 14:11:46 +02:00
|
|
|
} 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-10-23 23:11:59 +02:00
|
|
|
enableFallback: true,
|
2023-08-01 14:11:46 +02:00
|
|
|
})
|