-
Notifications
You must be signed in to change notification settings - Fork 481
I18n improvements #4222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
I18n improvements #4222
Conversation
This replaces older tools from frontend/src/i18n/tools.
The i18n config in the app module made it so that we would end up with wrong namespace locale files when there were colons in the translation keys.
skoeva
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: joaquimrocha The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1be1de4 to
b874d5b
Compare
|
@skoeva , CI is fine now. |
@joaquimrocha the comment from @skoeva about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new TypeScript-based i18n tool to improve the translator experience for Headlamp. It provides a unified command-line interface for managing translations with status views, file listings, extraction of empty translations, and copying translations between files.
- Adds a new TypeScript tool in
tools/i18n/with comprehensive test coverage - Introduces top-level npm commands (
i18n:status,i18n:list,i18n:extract,i18n:copy) - Deprecates old JavaScript tools in
frontend/src/i18n/tools/ - Adds extensive documentation for translators and developers
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/i18n/package.json | Defines the new i18n tool package with dependencies and npm scripts |
| tools/i18n/package-lock.json | Lock file for the new tool's dependencies |
| tools/i18n/tsconfig.json | TypeScript configuration for the i18n tool |
| tools/i18n/jest.config.js | Jest test configuration with coverage settings |
| tools/i18n/src/index.ts | Main CLI entry point using yargs for command parsing |
| tools/i18n/src/lib/types.ts | TypeScript type definitions for translations and stats |
| tools/i18n/src/lib/translations.ts | Core translation file operations (load, save, count, copy, extract) |
| tools/i18n/src/lib/stats.ts | Translation statistics and progress visualization |
| tools/i18n/src/lib/paths.ts | Path resolution utilities for finding project root and locales |
| tools/i18n/src/lib/colors.ts | Terminal color utilities for output formatting |
| tools/i18n/src/lib/commands.ts | Implementation of all CLI commands (status, list, extract, copy) |
| tools/i18n/test/translations.test.ts | Comprehensive integration tests for translation operations |
| tools/i18n/test/.gitignore | Ignores test artifacts and coverage reports |
| tools/i18n/README.md | Developer documentation for the tool |
| package.json | Adds top-level npm scripts for i18n commands |
| frontend/src/i18n/README.md | Updated with new command references and translator guidance |
| frontend/src/i18n/tools/extract-empty-translations.js | Marked as deprecated with migration notice |
| frontend/src/i18n/tools/copy-translations.js | Marked as deprecated with migration notice |
| docs/development/i18n/contributing.md | Comprehensive update for translators with new workflow and commands |
| app/electron/i18next-parser.config.js | Bug fix: changed namespaceSeparator to false |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


Summary
This PR adds a couple of tools to improve the experience for translators.
It adds a couple of top level commands:
npm run i18n:status -> prints progress bars for each locale
npm run i18n:list -> lists locales and the percentage of completion
Also moves the former copy/missing translation commands to this top level variant (check docs).
Also adds docs.
How to test
Check the docs and run the commands to test them out.