CLI tool for converting and validating i18n JSON and Excel files with placeholder validation
A command-line tool for easy conversion of i18n JSON files to Excel and back. Perfect for translation workflows in international projects.
--dry-run
option, no files are written, but a report on missing translations, duplicate keys, and placeholder consistency is generated{name}
or {count}
for consistency across all languagesnpm install -g i18n-excel-manager
npm install i18n-excel-manager --save-dev
Start the tool without parameters for interactive mode:
i18n-excel-manager
Follow the menu instructions to configure your conversion.
Default paths in the CLI:
public/assets/i18n
(Angular default)dist/translations.xlsx
Translations
# Using command syntax (recommended)
i18n-excel-manager i18n-to-excel --input ./locales --output ./translations.xlsx
# Short command aliases
i18n-excel-manager to-excel -i ./locales -o ./translations.xlsx
# Legacy syntax (deprecated)
i18n-excel-manager --to-excel --input ./locales --output ./translations.xlsx
# Using command syntax (recommended)
i18n-excel-manager excel-to-i18n --input ./translations.xlsx --output ./locales
# Short command aliases
i18n-excel-manager to-json -i ./translations.xlsx -o ./locales
# Legacy syntax (deprecated)
i18n-excel-manager --from-excel --input ./translations.xlsx --output ./locales
# Use default directories and settings
i18n-excel-manager i18n-to-excel
# 'to-excel' is an alias for 'i18n-to-excel'
i18n-excel-manager to-excel
# Specify source directory for i18n JSON files
i18n-excel-manager i18n-to-excel --input ./src/i18n
# Short option syntax
i18n-excel-manager i18n-to-excel -i ./src/i18n
# Specify output Excel file location
i18n-excel-manager i18n-to-excel --output ./translations/project.xlsx
# Short option syntax
i18n-excel-manager i18n-to-excel -o ./translations/project.xlsx
# Use a custom name for the Excel worksheet
i18n-excel-manager i18n-to-excel --sheet-name "MyProject"
# Short option syntax
i18n-excel-manager i18n-to-excel -s "MyProject"
# Check translations without creating files
i18n-excel-manager i18n-to-excel --dry-run
# Short option syntax
i18n-excel-manager i18n-to-excel -d
# Skip generating the missing translations report
i18n-excel-manager i18n-to-excel --no-report
# Using multiple options together
i18n-excel-manager i18n-to-excel -i ./frontend/i18n -o ./reports/translations.xlsx -s "Frontend" -d
# Use default files and settings
i18n-excel-manager excel-to-i18n
# 'to-json' is an alias for 'excel-to-i18n'
i18n-excel-manager to-json
# Specify source Excel file
i18n-excel-manager excel-to-i18n --input ./my-translations.xlsx
# Short option syntax
i18n-excel-manager excel-to-i18n -i ./my-translations.xlsx
# Specify output directory for JSON files
i18n-excel-manager excel-to-i18n --output ./src/assets/i18n
# Short option syntax
i18n-excel-manager excel-to-i18n -o ./src/assets/i18n
# Use a specific sheet from the Excel file
i18n-excel-manager excel-to-i18n --sheet-name "UI Texts"
# Short option syntax
i18n-excel-manager excel-to-i18n -s "UI Texts"
# Preview conversion without writing files
i18n-excel-manager excel-to-i18n --dry-run
# Short option syntax
i18n-excel-manager excel-to-i18n -d
# Using multiple options together
i18n-excel-manager excel-to-i18n -i ./external/client-translations.xlsx -o ./src/i18n -s "Final"
i18n-excel-manager --to-excel --input ./locales --output ./result.xlsx --sheet-name "Translations" --dry-run
i18n-excel-manager --from-excel --input ./result.xlsx --output ./new-locales --sheet-name "Translations"
# General help
i18n-excel-manager --help
# Command-specific help
i18n-excel-manager i18n-to-excel --help
i18n-excel-manager excel-to-i18n --help
The tool uses a config.json
file to define language mappings and default settings:
{
"languages": {
"de": "German",
"en": "English",
"fr": "French"
// ... more languages
},
"defaults": {
"sourcePath": "public/assets/i18n",
"targetFile": "dist/translations.xlsx",
"targetPath": "locales",
"sheetName": "Translations"
}
}
In the Excel sheet, the column headers will display the full language names (e.g., “German” instead of “de”), making it easier for translators to understand which language they’re working with.
The tool detects placeholders like {name}
or {count}
in the translation texts and checks whether they are consistently present in all language versions of a translation. If there are discrepancies, a warning appears in the report.
Example:
Key | German | English |
---|---|---|
greeting.message | Hallo {name}, du hast {count} Nachrichten. | Hello {name}, you have messages. |
The report will indicate that {count}
is missing in the English translation.
{
"common": {
"yes": "Ja",
"no": "Nein"
},
"login": {
"title": "Anmelden",
"submit": "Einloggen"
}
}
The tool creates an Excel file with the following structure:
Key | German | English | French |
---|---|---|---|
common.yes | Ja | Yes | Oui |
common.no | Nein | No | Non |
login.title | Anmelden | Login | Connexion |
login.submit | Einloggen | Sign in | Connecter |
npm test
npm run lint
Contributions are welcome! Please read CONTRIBUTING.md for details on the process.
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)For questions, bugs, or feature requests, please create an issue on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
Mario Kreitz - GitHub profile