aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/_locales/de/messages.json2
-rw-r--r--app/_locales/es/messages.json2
-rw-r--r--app/_locales/hn/messages.json2
-rw-r--r--app/_locales/nl/messages.json2
-rw-r--r--app/_locales/ru/messages.json3
-rw-r--r--app/_locales/sl/messages.json2
-rw-r--r--app/_locales/th/messages.json2
-rw-r--r--app/_locales/zh_TW/messages.json2
-rw-r--r--development/verify-locale-strings.js133
9 files changed, 75 insertions, 75 deletions
diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json
index 5116764d1..1d2619672 100644
--- a/app/_locales/de/messages.json
+++ b/app/_locales/de/messages.json
@@ -232,7 +232,7 @@
"done": {
"message": "Fertig"
},
- "downloadStatelogs": {
+ "downloadStateLogs": {
"message": "Statelogs herunterladen"
},
"dropped": {
diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json
index fa28b09da..f287674f1 100644
--- a/app/_locales/es/messages.json
+++ b/app/_locales/es/messages.json
@@ -247,7 +247,7 @@
"done": {
"message": "Completo"
},
- "downloadStatelogs": {
+ "downloadStateLogs": {
"message": "Descargar logs de estado"
},
"dropped": {
diff --git a/app/_locales/hn/messages.json b/app/_locales/hn/messages.json
index 3703faa13..323f4b4b3 100644
--- a/app/_locales/hn/messages.json
+++ b/app/_locales/hn/messages.json
@@ -223,7 +223,7 @@
"done": {
"message": "संपन्न"
},
- "downloadStatelogs": {
+ "downloadStateLogs": {
"message": "राज्य लॉग डाउनलोड करें"
},
"edit": {
diff --git a/app/_locales/nl/messages.json b/app/_locales/nl/messages.json
index 487002add..38289f602 100644
--- a/app/_locales/nl/messages.json
+++ b/app/_locales/nl/messages.json
@@ -223,7 +223,7 @@
"done": {
"message": "Gedaan"
},
- "downloadStatelogs": {
+ "downloadStateLogs": {
"message": "Staatslogboeken downloaden"
},
"edit": {
diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json
index 8903e0a66..cd43416ad 100644
--- a/app/_locales/ru/messages.json
+++ b/app/_locales/ru/messages.json
@@ -235,9 +235,8 @@
"done": {
"message": "Готово"
},
- "downloadStatelogs": {
+ "downloadStateLogs": {
"message": "Скачать журнал состояния"
- },
"dropped": {
"message": "Отброшена"
},
diff --git a/app/_locales/sl/messages.json b/app/_locales/sl/messages.json
index 0532f11b2..b089f3476 100644
--- a/app/_locales/sl/messages.json
+++ b/app/_locales/sl/messages.json
@@ -223,7 +223,7 @@
"done": {
"message": "Končano"
},
- "downloadStatelogs": {
+ "downloadStateLogs": {
"message": "Prenesi state dnevnike"
},
"edit": {
diff --git a/app/_locales/th/messages.json b/app/_locales/th/messages.json
index 887714f3f..3d7dec226 100644
--- a/app/_locales/th/messages.json
+++ b/app/_locales/th/messages.json
@@ -223,7 +223,7 @@
"done": {
"message": "เสร็จสิ้น"
},
- "downloadStatelogs": {
+ "downloadStateLogs": {
"message": "ดาวน์โหลดล็อกสถานะ"
},
"edit": {
diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json
index e39793430..9aaee0e16 100644
--- a/app/_locales/zh_TW/messages.json
+++ b/app/_locales/zh_TW/messages.json
@@ -235,7 +235,7 @@
"done": {
"message": "完成"
},
- "downloadStatelogs": {
+ "downloadStateLogs": {
"message": "下載狀態紀錄"
},
"dropped": {
diff --git a/development/verify-locale-strings.js b/development/verify-locale-strings.js
index b8fe5a7dc..8dc0a30f1 100644
--- a/development/verify-locale-strings.js
+++ b/development/verify-locale-strings.js
@@ -10,87 +10,88 @@
//
////////////////////////////////////////////////////////////////////////////////
-var fs = require('fs')
-var path = require('path')
+const fs = require('fs')
+const path = require('path')
+const localeIndex = require('../app/_locales/index.json')
console.log('Locale Verification')
-var locale = process.argv[2]
-if (!locale || locale == '') {
- console.log('Must enter a locale as argument. exitting')
- process.exit(1)
+const specifiedLocale = process.argv[2]
+if (specifiedLocale) {
+ console.log(`Verifying selected locale "${specifiedLocale}":\n\n`)
+ const locale = localeIndex.find(localeMeta => localeMeta.code === specifiedLocale)
+ verifyLocale({ localeMeta })
+} else {
+ console.log('Verifying all locales:\n\n')
+ localeIndex.forEach(localeMeta => {
+ verifyLocale({ localeMeta })
+ console.log('\n')
+ })
}
-console.log("verifying for locale " + locale)
-localeFilePath = path.join(process.cwd(), 'app', '_locales', locale, 'messages.json')
-try {
- localeObj = JSON.parse(fs.readFileSync(localeFilePath, 'utf8'));
-} catch (e) {
- if(e.code == 'ENOENT') {
- console.log('Locale file not found')
- } else {
- console.log('Error opening your locale file: ', e)
+
+function verifyLocale({ localeMeta }) {
+ const localeCode = localeMeta.code
+ const localeName = localeMeta.name
+
+ try {
+ const localeFilePath = path.join(process.cwd(), 'app', '_locales', localeCode, 'messages.json')
+ targetLocale = JSON.parse(fs.readFileSync(localeFilePath, 'utf8'));
+ } catch (e) {
+ if (e.code == 'ENOENT') {
+ console.log('Locale file not found')
+ } else {
+ console.log(`Error opening your locale ("${localeCode}") file: `, e)
+ }
+ process.exit(1)
}
- process.exit(1)
-}
-englishFilePath = path.join(process.cwd(), 'app', '_locales', 'en', 'messages.json')
-try {
- englishObj = JSON.parse(fs.readFileSync(englishFilePath, 'utf8'));
-} catch (e) {
- if(e.code == 'ENOENT') {
- console.log("English File not found")
- } else {
- console.log("Error opening english locale file: ", e)
+ try {
+ const englishFilePath = path.join(process.cwd(), 'app', '_locales', 'en', 'messages.json')
+ englishLocale = JSON.parse(fs.readFileSync(englishFilePath, 'utf8'));
+ } catch (e) {
+ if(e.code == 'ENOENT') {
+ console.log('English File not found')
+ } else {
+ console.log('Error opening english locale file: ', e)
+ }
+ process.exit(1)
}
- process.exit(1)
-}
-console.log('\tverifying whether all your locale strings are contained in the english one')
+ // console.log(' verifying whether all your locale ("${localeCode}") strings are contained in the english one')
+ const extraItems = compareLocalesForMissingItems({ base: targetLocale, subject: englishLocale })
+ // console.log('\n verifying whether your locale ("${localeCode}") contains all english strings')
+ const missingItems = compareLocalesForMissingItems({ base: englishLocale, subject: targetLocale })
-var counter = 0
-var foundErrorA = false
-var notFound = [];
-Object.keys(localeObj).forEach(function(key){
- if (!englishObj[key]) {
- foundErrorA = true
- notFound.push(key)
- }
- counter++
-})
+ const englishEntryCount = Object.keys(englishLocale).length
+ const coveragePercent = 100 * (englishEntryCount - missingItems.length) / englishEntryCount
-if (foundErrorA) {
- console.log('\nThe following string(s) is(are) not found in the english locale:')
- notFound.forEach(function(key) {
- console.log(key)
- })
-} else {
- console.log('\tall ' + counter +' strings declared in your locale were found in the english one')
-}
+ console.log(`Status of **${localeName} (${localeCode})** ${coveragePercent.toFixed(2)}% coverage:`)
-console.log('\n\tverifying whether your locale contains all english strings')
+ if (extraItems.length) {
+ console.log('\nMissing from english locale:')
+ extraItems.forEach(function(key) {
+ console.log(` - [ ] ${key}`)
+ })
+ } else {
+ // console.log(` all ${counter} strings declared in your locale ("${localeCode}") were found in the english one`)
+ }
-var counter = 0
-var foundErrorB = false
-var notFound = [];
-Object.keys(englishObj).forEach(function(key){
- if (!localeObj[key]) {
- foundErrorB = true
- notFound.push(key)
+ if (missingItems.length) {
+ console.log(`\nMissing:`)
+ missingItems.forEach(function(key) {
+ console.log(` - [ ] ${key}`)
+ })
+ } else {
+ // console.log(` all ${counter} english strings were found in your locale ("${localeCode}")!`)
}
- counter++
-})
-if (foundErrorB) {
- console.log('\nThe following string(s) is(are) not found in the your locale:')
- notFound.forEach(function(key) {
- console.log(key)
- })
-} else {
- console.log('\tall ' + counter +' english strings were found in your locale!')
+ if (!extraItems.length && !missingItems.length) {
+ console.log('Full coverage : )')
+ }
}
-if (!foundErrorA && !foundErrorB) {
- console.log('You are good to go')
-} \ No newline at end of file
+function compareLocalesForMissingItems({ base, subject }) {
+ return Object.keys(base).filter((key) => !subject[key])
+}