feat: Add translation merge CLI and complete i18n for 4 locales#29
Merged
feat: Add translation merge CLI and complete i18n for 4 locales#29
Conversation
- Add `merge` command to integrate external translations while preserving source references - Add `check` command to verify translation completeness (CI-ready) - Update `compile` command to use msgfmt, avoiding false-positive format string errors with Jinja2 templates - Add Afrikaans (af) locale - Complete translations for es, de, fr, af (683 strings each, 100%) - Add translations CI job to .github/workflows/ci.yml - Extract and update POT template with current source strings
The compile command was refactored to use msgfmt directly instead of pybabel compile to avoid false-positive format string errors with Jinja2 templates. The tests were still expecting the old behavior: - test_compile_success: Was creating a new MagicMock instead of using the path_resolver fixture properly. Updated assertions to match new output format. - test_compile_failure: Was mocking run_command, but the new implementation uses subprocess.run directly. Updated to mock subprocess.run and create a PO file for the compile to process.
Add comprehensive test coverage for the new translation CLI commands: - TestMergeCommand: Tests for merge success, missing target file, and --no-compile option - TestCheckCommand: Tests for complete translations, missing translations, --warn-only mode, and --skip option These tests improve coverage for manage_translations.py from 21% to 40%, helping meet the 77% overall coverage threshold.
polib is required for the merge and check commands in manage_translations.py. Adding it to dev dependencies ensures it's available when running tests in CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mergecommand tomanage-translationsCLI for integrating external translation files while preserving source referencescheckcommand to verify translation completeness (exits non-zero if issues found)compilecommand to usemsgfmtinstead ofpybabel compileto avoid false-positive format string errors with Jinja2 templatesNew CLI Commands
Test plan
uv run manage-translations check- should pass with all locales at 100%uv run manage-translations compile- should compile all 5 locales