Closed plastikfan closed 2 years ago
Currently, en_GB uses the en file. This should now be changed to be en_GB, now that the locale has been correctly setup using locale-gen
This is the error message that is generated as a result of trying to load en/translation.json, that initially was missing:
===> cwd: '/home/plastikfan/dev/github/snivilization/zoon/packages/infexor' [ [Error: ENOENT: no such file or directory, open './locales/en/translation.json'] { errno: -2, code: 'ENOENT', syscall: 'open', path: './locales/en/translation.json' } ]
The only way I could get rid of this message was to create a dummy en/transaltion file.
i18next is composing a list of languages to load and since we provide this config:
const OUT = "dist"; // should come from rollup.options.mjs ... const EN_GB = "en-GB"; const EN_US = "en-US"; const TRANSLATION = "translation"; export default { backend: { loadPath: `./${OUT}/locales/{{lng}}/{{ns}}.json` }, fallbackLng: EN_GB, preload: [EN_GB, EN_US], ns: [TRANSLATION], defaultNS: TRANSLATION };
it tries to load "en-GB", "en-US" and "en". Why does it try and load "en"?
This issue is fixed by using a load strategy:
const OUT = "dist"; // should come from rollup.options.mjs ... const EN_GB = "en-GB"; const EN_US = "en-US"; const TRANSLATION = "translation"; export default { backend: { loadPath: `./${OUT}/locales/{{lng}}/{{ns}}.json` }, load: 'currentOnly', fallbackLng: EN_GB, preload: [EN_GB, EN_US], ns: [TRANSLATION], defaultNS: TRANSLATION };
See options
Currently, en_GB uses the en file. This should now be changed to be en_GB, now that the locale has been correctly setup using locale-gen
This is the error message that is generated as a result of trying to load en/translation.json, that initially was missing:
The only way I could get rid of this message was to create a dummy en/transaltion file.
i18next is composing a list of languages to load and since we provide this config:
it tries to load "en-GB", "en-US" and "en". Why does it try and load "en"?
This issue is fixed by using a load strategy:
See options