Skip to content

feat: Add translation merge CLI and complete i18n for 4 locales#29

Merged
mverteuil merged 4 commits intomainfrom
feature/translation-merge-cli
Feb 23, 2026
Merged

feat: Add translation merge CLI and complete i18n for 4 locales#29
mverteuil merged 4 commits intomainfrom
feature/translation-merge-cli

Conversation

@mverteuil
Copy link
Owner

Summary

  • Add merge command to manage-translations CLI for integrating external translation files while preserving source references
  • Add check command to verify translation completeness (exits non-zero if issues found)
  • Update compile command to use msgfmt instead of pybabel compile to avoid false-positive format string errors with Jinja2 templates
  • Add Afrikaans (af) locale
  • Complete translations for Spanish, German, French, and Afrikaans (683 strings each, 100%)
  • Add translations CI job to verify completeness on every push/PR

New CLI Commands

# Merge external translations (preserves source references)
uv run manage-translations merge es /path/to/spanish.po

# Check translation completeness (CI-ready)
uv run manage-translations check

# Check with non-blocking mode
uv run manage-translations check --warn-only

Test plan

  • Run uv run manage-translations check - should pass with all locales at 100%
  • Run uv run manage-translations compile - should compile all 5 locales
  • Verify CI workflow runs the translations check job

- 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.
@mverteuil mverteuil merged commit 43ecd13 into main Feb 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant