From e8093f5dc50513106fcba27505a52f50beaf911e Mon Sep 17 00:00:00 2001 From: Matteias Collet Date: Wed, 6 Jan 2021 11:29:40 +0100 Subject: [PATCH] grammar --- scripts/compare_translations.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/compare_translations.js b/scripts/compare_translations.js index 71c9153..3768cac 100644 --- a/scripts/compare_translations.js +++ b/scripts/compare_translations.js @@ -7,7 +7,7 @@ const locales = require(path.join(__dirname, '../site/.vuepress/i18n/locales.jso * @param {*} path The already visited path */ const getLeaves = (node, path = null) => { - if (typeof node === 'string') return leavePaths.push(path); + if (typeof node === 'string') return leafPaths.push(path); if (typeof node != 'object') throw new Error(typeof node); const currentPath = path ? `${path}.` : ''; Object.keys(node).forEach((key) => getLeaves(node[key], `${currentPath}${key}`)); @@ -40,15 +40,15 @@ const defaultTranslation = translations.find((t) => t.lang === locales['/'].lang console.log(`Default translation set to ${defaultTranslation.lang}`); // Holds the paths to all leaf nodes of the default translation -const leavePaths = []; +const leafPaths = []; getLeaves(defaultTranslation.values); -console.log('Detected translations: ', leavePaths); +console.log('Detected translations: ', leafPaths); // Compare all translations to the default translation translations.forEach((t) => { console.log(`Comparing ${t.lang} to ${defaultTranslation.lang}`); - leavePaths.forEach((p) => { + leafPaths.forEach((p) => { const value = getNestedProperty(t.values, p); if (value == null || typeof value !== 'string') { console.warn(`${t.lang} is missing a translation at '${p}'`);