1.0.2 • Published 1 year ago
@nicolalopatriello/i18n-analyzer v1.0.2
i18n-analyzer

i18n-analyzer is a tool designed to optimize and validate file-based internationalization (i18n) runtime translations. It helps developers maintain clean, efficient, and consistent translation files by performing automated checks on your i18n files.
Features
Validation Checks
- File-Mismatch: Identifies missing keys or extra keys between the base language file and other language files.
- Empty-Values: Flags keys with empty or undefined values in any language file.
- Unused-keys: Detects translation keys in the base language file that are not used in your codebase.
Installation
To use i18n-analyzer, install it via npm:
npm install --save @nicolalopatriello/i18n-analyzerConfiguration
The tool requires a configuration file to run. This file tells the analyzer where your translation files are located and which file to use as the base language.
Configuration File Format
Create a configuration file (e.g., .i18nanalyzer.json) in the root folder of your project. The file should have the following structure:
{
"langFolder": "./libs/shared-assets/i18n", // Path to the folder containing your language files
"baseLang": "./libs/shared-assets/i18n/it.json" // Path to your base language file (e.g., Italian)
}Usage
After setting up the configuration, run the analyzer with the following command:
i18n-analyzer