From ee5c8a4278683775e1153be0e892df2d35138bba Mon Sep 17 00:00:00 2001 From: Eric Nakagawa Date: Tue, 24 Oct 2017 15:33:43 -0700 Subject: [PATCH] Adds a note that languages.js is autogenerated Add a comment about auto-generation to top of en.json file --- lib/write-translations.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/write-translations.js b/lib/write-translations.js index df49c727bd..1328be5a55 100755 --- a/lib/write-translations.js +++ b/lib/write-translations.js @@ -25,7 +25,9 @@ let currentTranslations = { "pages-strings": {} }; if (fs.existsSync(path)) { - currentTranslations = JSON.parse(fs.readFileSync(CWD + "/i18n/en.json", "utf8")); + currentTranslations = JSON.parse( + fs.readFileSync(CWD + "/i18n/en.json", "utf8") + ); } function writeFileAndCreateFolder(file, content) { @@ -139,15 +141,24 @@ function execute() { "Translate"; translations["pages-strings"] = Object.assign( translations["pages-strings"], - currentTranslations["pages-strings"], + currentTranslations["pages-strings"] ); translations["localized-strings"] = Object.assign( translations["localized-strings"], - currentTranslations["localized-strings"], + currentTranslations["localized-strings"] ); writeFileAndCreateFolder( CWD + "/i18n/en.json", - JSON.stringify(translations, null, 2) + JSON.stringify( + Object.assign( + { + _comment: "This file is auto-generated by write-translations.js" + }, + translations + ), + null, + 2 + ) ); }