Adds a note that languages.js is autogenerated

Add a comment about auto-generation to top of en.json file
This commit is contained in:
Eric Nakagawa 2017-10-24 15:33:43 -07:00
parent fcc168af42
commit ee5c8a4278

View File

@ -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
)
);
}