Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
feat(checkmissingtranslations.ts): add language in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosvega91 committed May 3, 2020
1 parent 75f9981 commit d20b9c7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/checkMissingTranslations.ts
Expand Up @@ -2,14 +2,15 @@ import { Resource, ResourceKey } from 'i18next'
import i18n from '../src/i18n'

const checkRecursiveTranslation = (
comparingLanguage: string,
searchingPath: string,
defaultLanguageObject: ResourceKey,
comparingLanguageObject: ResourceKey,
) => {
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
Expand All @@ -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],
Expand Down Expand Up @@ -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('')
})
}
Expand Down

0 comments on commit d20b9c7

Please sign in to comment.