mirror of
https://github.com/guezoloic/website.git
synced 2026-01-25 09:34:24 +00:00
fork: move from guezoloic repo
This commit is contained in:
23
src/utils/translation.ts
Normal file
23
src/utils/translation.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
|
||||
import en from '../locales/en.json';
|
||||
import fr from '../locales/fr.json';
|
||||
|
||||
const resources = { en: { translation: en }, fr: { translation: fr } };
|
||||
|
||||
const userLang = navigator.language.startsWith('fr') ? 'fr' : 'en';
|
||||
|
||||
i18n
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
resources,
|
||||
lng: userLang,
|
||||
fallbackLng: 'en',
|
||||
interpolation: { escapeValue: false },
|
||||
})
|
||||
;
|
||||
|
||||
document.documentElement.lang = i18n.language;
|
||||
|
||||
export default i18n;
|
||||
Reference in New Issue
Block a user