aboutsummaryrefslogtreecommitdiffstats
path: root/development/verify-locale-strings.js
diff options
context:
space:
mode:
Diffstat (limited to 'development/verify-locale-strings.js')
-rw-r--r--development/verify-locale-strings.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/development/verify-locale-strings.js b/development/verify-locale-strings.js
index 8dc0a30f1..0eef2b35d 100644
--- a/development/verify-locale-strings.js
+++ b/development/verify-locale-strings.js
@@ -1,4 +1,4 @@
-////////////////////////////////////////////////////////////////////////////////
+// //////////////////////////////////////////////////////////////////////////////
//
// Locale verification script
//
@@ -8,7 +8,7 @@
//
// will check the given locale against the strings in english
//
-////////////////////////////////////////////////////////////////////////////////
+// //////////////////////////////////////////////////////////////////////////////
const fs = require('fs')
const path = require('path')
@@ -20,7 +20,7 @@ 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 })
+ verifyLocale({ locale })
} else {
console.log('Verifying all locales:\n\n')
localeIndex.forEach(localeMeta => {
@@ -30,16 +30,16 @@ if (specifiedLocale) {
}
-
-function verifyLocale({ localeMeta }) {
+function verifyLocale ({ localeMeta }) {
const localeCode = localeMeta.code
const localeName = localeMeta.name
+ let targetLocale, englishLocale
try {
const localeFilePath = path.join(process.cwd(), 'app', '_locales', localeCode, 'messages.json')
- targetLocale = JSON.parse(fs.readFileSync(localeFilePath, 'utf8'));
+ targetLocale = JSON.parse(fs.readFileSync(localeFilePath, 'utf8'))
} catch (e) {
- if (e.code == 'ENOENT') {
+ if (e.code === 'ENOENT') {
console.log('Locale file not found')
} else {
console.log(`Error opening your locale ("${localeCode}") file: `, e)
@@ -49,9 +49,9 @@ function verifyLocale({ localeMeta }) {
try {
const englishFilePath = path.join(process.cwd(), 'app', '_locales', 'en', 'messages.json')
- englishLocale = JSON.parse(fs.readFileSync(englishFilePath, 'utf8'));
+ englishLocale = JSON.parse(fs.readFileSync(englishFilePath, 'utf8'))
} catch (e) {
- if(e.code == 'ENOENT') {
+ if (e.code === 'ENOENT') {
console.log('English File not found')
} else {
console.log('Error opening english locale file: ', e)
@@ -71,7 +71,7 @@ function verifyLocale({ localeMeta }) {
if (extraItems.length) {
console.log('\nMissing from english locale:')
- extraItems.forEach(function(key) {
+ extraItems.forEach(function (key) {
console.log(` - [ ] ${key}`)
})
} else {
@@ -80,7 +80,7 @@ function verifyLocale({ localeMeta }) {
if (missingItems.length) {
console.log(`\nMissing:`)
- missingItems.forEach(function(key) {
+ missingItems.forEach(function (key) {
console.log(` - [ ] ${key}`)
})
} else {
@@ -92,6 +92,6 @@ function verifyLocale({ localeMeta }) {
}
}
-function compareLocalesForMissingItems({ base, subject }) {
+function compareLocalesForMissingItems ({ base, subject }) {
return Object.keys(base).filter((key) => !subject[key])
}