Skip to content

Commit

Permalink
Fixes issue jeresig#124 JSON is overwritten if unable to parse the fi…
Browse files Browse the repository at this point in the history
…le in DEV mode.

If JSON file exists and in DEV mode but the locale is undefined - HALTS ALL execution with an expection to prevent the files from being overwritten.
  • Loading branch information
Netgator committed Feb 21, 2019
1 parent 8979852 commit 6327a4d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ i18n.prototype = {

locale = this.defaultLocale;

if ((this.devMode) && (fs.existsSync(this.locateFile(locale)))) {
throw new Error('Please correct potential parse errors in i18n JSON file ' + this.locateFile(locale));
}

this.initLocale(locale, {});
}

Expand Down

0 comments on commit 6327a4d

Please sign in to comment.