Ghost/ghost/i18n/lib/i18n.js
Daniel Lockyer fb030353fe
Moved i18n translations into JSON files
refs https://github.com/TryGhost/Ghost/issues/15502

- plain JSON files are cleaner and less overwhelming than boilerplate JS
  files, and given they're going to be automatically generated, we
  probably won't be able to support comments anyway
2023-01-18 17:03:22 +01:00

28 lines
649 B
JavaScript

const i18next = require('i18next');
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,
resources: {
en: {
translation: require('../locales/en.json')
},
nl: {
translation: require('../locales/nl.json')
}
}
});
return i18nextInstance;
};