2023-01-18 15:21:17 +03:00
|
|
|
const i18next = require('i18next');
|
|
|
|
|
2023-01-18 20:21:36 +03:00
|
|
|
const RESOURCES = {
|
|
|
|
en: {
|
|
|
|
translation: require('../locales/en.json')
|
|
|
|
},
|
|
|
|
nl: {
|
|
|
|
translation: require('../locales/nl.json')
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const SUPPORTED_LOCALES = Object.keys(RESOURCES);
|
|
|
|
|
2023-01-18 15:21:17 +03:00
|
|
|
module.exports = (lng = 'en') => {
|
|
|
|
const i18nextInstance = i18next.createInstance();
|
|
|
|
i18nextInstance.init({
|
|
|
|
lng,
|
|
|
|
debug: process.env.NODE_ENV === 'development',
|
|
|
|
|
|
|
|
// allow keys to be phrases having `:`, `.`
|
|
|
|
nsSeparator: false,
|
|
|
|
keySeparator: false,
|
|
|
|
|
|
|
|
// do not load a fallback
|
|
|
|
fallbackLng: false,
|
|
|
|
|
2023-01-18 20:21:36 +03:00
|
|
|
resources: RESOURCES
|
2023-01-18 15:21:17 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
return i18nextInstance;
|
|
|
|
};
|
2023-01-18 20:21:36 +03:00
|
|
|
|
|
|
|
module.exports.SUPPORTED_LOCALES = SUPPORTED_LOCALES;
|