Created
December 10, 2020 09:58
-
-
Save ayeshN/8bc12a7968511ceb3ecb1b89517b85fd to your computer and use it in GitHub Desktop.
i18next configuration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import i18n from 'i18next'; | |
import { initReactI18next } from 'react-i18next'; | |
// //local imports | |
import en from './locales/en.json'; | |
import sv from './locales/sv.json'; | |
let language = localStorage.getItem('language'); | |
if (language === undefined) { | |
language = 'sv'; | |
} | |
i18n.use(initReactI18next).init({ | |
resources: { | |
en: { translations: en }, | |
sv: { translations: sv }, | |
}, | |
fallbackLng: 'sv', | |
lng: 'sv', | |
// debug only when not in production | |
debug: process.env.NODE_ENV !== 'production', | |
ns: ['translations'], | |
defaultNS: 'translations', | |
keySeparator: false, | |
interpolation: { | |
escapeValue: false, | |
formatSeparator: ',', | |
}, | |
react: { | |
wait: true, | |
}, | |
}); | |
export default i18n; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment