mashpie / i18n-node

Lightweight simple translation module for node.js / express.js with dynamic json storage. Uses common __('...') syntax in app and templates.
MIT License
3.09k stars 421 forks source link

i18n ignores en.json language file #505

Closed david-fiaty closed 2 years ago

david-fiaty commented 2 years ago

I have an app with 2 languages in 2 json files: en.json and fr.json. It looks like i18n is just ignoring my en.json file:

I've tried to set the locales config parameters : locales: ['en', 'fr'] And also to set a default locale: defaultLocale: 'en'

Same result, the en file seems to be ignored. What could be causing this issue?

The initialization code:

const path = require('path');
const i18n = require('i18n');

i18n.configure({
  defaultLocale: 'en',
  directory: path.join(__dirname, './i18n')
});
david-fiaty commented 2 years ago

okay sorry, my en.json file was invalid. Closing this. Question: shouldn't the app throw an error when a json file is invalid?