diff --git a/checkTranslations.mjs b/checkTranslations.mjs new file mode 100644 index 0000000..1ecbb11 --- /dev/null +++ b/checkTranslations.mjs @@ -0,0 +1,38 @@ +import translation_en from './src/translations/en.js' +import translation_de from './src/translations/de.js' +import translation_ru from './src/translations/ru.js' +import translation_nl from './src/translations/nl.js' +import translation_fr from './src/translations/fr.js' + +const langs = ["en", "de", "ru", "nl", "fr"]; + +const translations_dict = { + en: translation_en, + de: translation_de, + ru: translation_ru, + nl: translation_nl, + fr: translation_fr, +} + +let en_keys = [...new Map(Object.entries(translations_dict.en)).keys()]; + +function arrayDiff(a, b) { + return { + missing: a.filter(x => !b.includes(x)), + extra: b.filter(x => !a.includes(x)), + }; +} + +for (let lang_num in langs) { + let lang = new Map(Object.entries(translations_dict[langs[lang_num]])); + if (lang == "en") continue; + let lang_keys = [...lang.keys()]; + let di = arrayDiff(en_keys, [...lang.keys()]) + console.log("Language:", langs[lang_num]) + if (di.missing.length > 0) { + console.log("Missing: ", di.missing.join(", ")) + } + if (di.extra.length > 0) { + console.log("Extra Keys (maybe deprecated, renamed or no longer exists, check git log): ", di.extra.join(", ")) + } +} diff --git a/readme.md b/readme.md index 0488edf..09200bd 100644 --- a/readme.md +++ b/readme.md @@ -19,4 +19,12 @@ WEBPACK_MODE=development BROWSER=google-chrome npx webpack serve ## Translating Make sure to keep the order of comments and tags in the translation files `src/translations` the same. -When you want to PR an update, title it "Changed wording in..." or "Synced translations in de" or something along those lines. \ No newline at end of file +When you want to PR an update, title it "Changed wording in..." or "Synced translations in de" or something along those lines. + +To get a list of what languages need what translations added, run `node ./checkTranslations.mjs` +Example: +``` +Language: fr +Missing: unseal_input_btn, unseal_qr_btn +``` +Means those two missing things need to be added to french. \ No newline at end of file diff --git a/src/pages/Unseal.js b/src/pages/Unseal.js index 9c28474..525d7e9 100644 --- a/src/pages/Unseal.js +++ b/src/pages/Unseal.js @@ -7,7 +7,7 @@ import { MarginInline } from "../elements/MarginInline.js"; import i18next from 'i18next'; import QrScanner from 'qr-scanner'; - /* eslint-disable import/no-unresolved */ +/* eslint-disable import/no-unresolved */ import qrScannerWorkerSource from '!!raw-loader!qr-scanner/qr-scanner-worker.min.js'; QrScanner.WORKER_PATH = URL.createObjectURL(new Blob([qrScannerWorkerSource]));