Skip to content

Instantly share code, notes, and snippets.

@ayeshN
Created December 10, 2020 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayeshN/8bc12a7968511ceb3ecb1b89517b85fd to your computer and use it in GitHub Desktop.
Save ayeshN/8bc12a7968511ceb3ecb1b89517b85fd to your computer and use it in GitHub Desktop.
i18next configuration file
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