From d20b9c718dcb3f72142cb3280d779d7ef74f973e Mon Sep 17 00:00:00 2001 From: marcosvega91 Date: Sun, 3 May 2020 08:09:29 +0200 Subject: [PATCH] feat(checkmissingtranslations.ts): add language in logs --- scripts/checkMissingTranslations.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/checkMissingTranslations.ts b/scripts/checkMissingTranslations.ts index 9d15b8fd84..a3e823beeb 100644 --- a/scripts/checkMissingTranslations.ts +++ b/scripts/checkMissingTranslations.ts @@ -2,6 +2,7 @@ import { Resource, ResourceKey } from 'i18next' import i18n from '../src/i18n' const checkRecursiveTranslation = ( + comparingLanguage: string, searchingPath: string, defaultLanguageObject: ResourceKey, comparingLanguageObject: ResourceKey, @@ -9,7 +10,7 @@ const checkRecursiveTranslation = ( if (typeof defaultLanguageObject === 'string' || typeof comparingLanguageObject === 'string') { if (typeof defaultLanguageObject === 'object') { console.log( - `πŸ“™ Found a string for path ${searchingPath} while is and object for the default language`, + `πŸ“™ Found a string for path ${searchingPath} and language ${comparingLanguage} while is and object for the default language`, ) } return @@ -21,9 +22,12 @@ const checkRecursiveTranslation = ( } defaultKeys.forEach((key) => { if (!comparingLanguageObject[key]) { - console.log(`πŸ“™ The key ${key} is not present for path ${searchingPath}`) + console.log( + `πŸ“™ The key ${key} is not present for path ${searchingPath} and language ${comparingLanguage}`, + ) } else { checkRecursiveTranslation( + comparingLanguage, `${searchingPath}-->${key}`, defaultLanguageObject[key], comparingLanguageObject[key], @@ -51,7 +55,7 @@ const run = () => { } console.log(`🀞Checking ${language}`) console.log('') - checkRecursiveTranslation(language, resources[defaultLanguage], resources[language]) + checkRecursiveTranslation(language, language, resources[defaultLanguage], resources[language]) console.log('') }) }