jeresig / i18n-node-2

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

Fixes issue #124 JSON is overwritten if unable to parse the file in DEV #125

Open Netgator opened 5 years ago

Netgator commented 5 years ago

Fixes issue #124 JSON is overwritten if unable to parse the file in DEV mode.

If locale JSON file exists AND package is in DEV mode AND the locale is undefined (unreadable) - This HALTS ALL execution by throwing an exception which prevents the locale file(s) from being overwritten inadvertently. The issue is when the JSON is invalid (even just missing a comma) the file is automatically overwritten which can cause developers to loose most existing lines from the file and no way to recover...