All files / scripts check-missing-translations.ts

0% Statements 0/21
0% Branches 0/4
0% Functions 0/3
0% Lines 0/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                                                                             
#!/usr/bin/env node
 
import { blue, yellow, white, red, green } from "ansis";
import { checkMissingTranslations } from "./locale/check-translations";
 
async function runTranslationCheck() {
  try {
    console.log(blue`\nChecking for missing translations...\n`);
 
    const result = await checkMissingTranslations();
    const { hasMissingTranslations, missingTranslations } = result;
 
    if (missingTranslations.length > 0) {
      missingTranslations.forEach(({ key, file, missingLocales }) => {
        console.log(white`\nšŸ”‘ Key: ${key}`);
        missingLocales.forEach((locale) => {
          console.log(red`  - Missing in šŸ“‚ locales/${locale}/${file}.json`);
        });
        console.log();
      });
    } else {
      console.log(green`āœ“ All translations present`);
    }
 
    if (hasMissingTranslations) {
      console.error(red`\nāš ļø  Some translations are missing. Please add them to maintain full language support.\n`);
      process.exit(1);
    } else {
      console.log(green`\nāœ“ All translations are complete!\n`);
      process.exit(0);
    }
  } catch (error) {
    console.error(red`\nError checking translations: ${error}`);
    process.exit(1);
  }
}
 
runTranslationCheck();