mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 07:51:55 +03:00
2cf161168b
refs https://github.com/TryGhost/Ghost/issues/15502 - the amazing `i18next-parser` dependency will extract our translated strings from Portal and dump them into locale files, so we never have to add them manually
34 lines
729 B
JavaScript
34 lines
729 B
JavaScript
const i18next = require('i18next');
|
|
|
|
const RESOURCES = {
|
|
en: {
|
|
translation: require('../locales/en.json')
|
|
},
|
|
nl: {
|
|
translation: require('../locales/nl.json')
|
|
}
|
|
};
|
|
|
|
const SUPPORTED_LOCALES = Object.keys(RESOURCES);
|
|
|
|
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: RESOURCES
|
|
});
|
|
|
|
return i18nextInstance;
|
|
};
|
|
|
|
module.exports.SUPPORTED_LOCALES = SUPPORTED_LOCALES;
|