Created
April 16, 2020 22:47
-
-
Save tim-we/460382e019ebc431c4673ef9b6eda62e to your computer and use it in GitHub Desktop.
Create a simple text file containing all the strings from a messages.json file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
let lang = "it"; | |
let i18n = JSON.parse(fs.readFileSync("src/_locales/" + lang + "/messages.json", "utf8")); | |
let output = ""; | |
for(const prop in i18n) { | |
//output += prop + ": "; | |
output += i18n[prop].message + "\n---\n"; | |
} | |
fs.writeFileSync("strings_" + lang + ".txt", output); | |
console.log("Done."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment