diff options
author | Marius David Wieschollek <passwords.public@mdns.eu> | 2020-12-22 18:30:58 +0300 |
---|---|---|
committer | Marius David Wieschollek <passwords.public@mdns.eu> | 2020-12-22 18:30:58 +0300 |
commit | 518dd86661c9108da98aea8c070362c56f94a8c5 (patch) | |
tree | 3ca66a572642c53be483534a5b16a76c9b62869d /scripts | |
parent | 69b5a708367afb929fc1fb5308a9da18a0c4b62d (diff) |
Added more language tag descriptions
Signed-off-by: Marius David Wieschollek <passwords.public@mdns.eu>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/sync-message-descriptions.mjs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/sync-message-descriptions.mjs b/scripts/sync-message-descriptions.mjs new file mode 100644 index 0000000..b568d34 --- /dev/null +++ b/scripts/sync-message-descriptions.mjs @@ -0,0 +1,42 @@ +import LanguageTags from '../src/platform/generic/_locales/en/messages.json'; +import LanguageTagsDe from '../src/platform/generic/_locales/de/messages.json'; +import LanguageTagsIt from '../src/platform/generic/_locales/it/messages.json'; +import fs from 'fs'; +import path from 'path'; + + +let languages = { + de: LanguageTagsDe, + it: LanguageTagsIt + }, + changes = {}; + +for(let tag in LanguageTags) { + if(!LanguageTags.hasOwnProperty(tag)) continue; + let languageTag = LanguageTags[tag]; + if(!languageTag.hasOwnProperty('description') || languageTag.description.length === 0) continue; + + for(let language in languages) { + if(!languages.hasOwnProperty(language)) continue; + if(!languages[language].hasOwnProperty(tag)) continue; + let translation = languages[language][tag]; + + if(!translation.hasOwnProperty('description') || translation.description.length === 0 || translation.description !== languageTag.description) { + translation.description = languageTag.description; + changes[language] = true; + } + + if(languageTag.hasOwnProperty('placeholders') && (translation.hasOwnProperty('placeholders') || JSON.stringify(languageTag.placeholders) !== JSON.stringify(translation.placeholders))) { + translation.placeholders = languageTag.placeholders; + changes[language] = true; + } + } +} + +for(let language in changes) { + if(!changes.hasOwnProperty(language) || !languages.hasOwnProperty(language)) continue; + + let data = JSON.stringify(languages[language], null, 4), + file = path.resolve(`src/platform/generic/_locales/${language}/messages.json`); + fs.writeFileSync(file, data); +}
\ No newline at end of file |