Skip to content

Improve Translation Coverage, Localization Tests, and Documentation for i18n #918

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

mahdirahimi1999
Copy link
Member

@mahdirahimi1999 mahdirahimi1999 commented Jun 20, 2025

Improve i18n Reliability, Translation Coverage, and Documentation

This pull request introduces a set of enhancements aimed at improving internationalization (i18n) support across the project. The updates focus on localization testing, translation accuracy, and developer documentation to ensure a more stable and user-friendly multilingual experience.


Summary of Changes

1. Improved Localization Reliability

The i18n/l10n test suite has been refactored to enhance maintainability and catch common localization issues early in development.

Notable improvements:

  • Translation Coverage Validation: Tests now ensure all message keys exist across all .po files, and every language declared in constants has a corresponding translation file. This prevents missing translations in production.
  • Localized Error Message Tests: Extended coverage to include translated error messages, including edge cases like invalid API settings (ALGORITHM) and token validation errors.
  • Developer-Friendly Debugging: Leveraged subtests to surface multiple translation failures in a single test run, improving development efficiency.
  • Test Isolation: Tests that modify global or runtime settings are now isolated to prevent side effects and order-dependent failures.

2. Translation Improvements

  • French (fr):
    • Fixed capitalization for the translation of "user" to match the .po file (Utilisateur).
  • Chilean Spanish (es_CL):
    • Fixed capitalization for the translation of "user" to match the .po file (Usuario).
  • Persian (fa, fa_IR):
    • Refined translations for clarity and consistency, especially in error messages and algorithm-related terms.
  • Dutch (nl_NL):
    • Fixed a typo in the translation for "Unrecognized algorithm type".

3. Test Dependency Update

  • Added polib to setup.py test dependencies to enable .po file parsing in tests and CI environments.

4. Documentation Updates

  • Improved documentation with clear instructions on enabling translation support via LOCALE_PATHS.

Impact

  • Developers gain a more dependable localization testing framework.
  • Translators benefit from more consistent and accurate source strings.
  • Users enjoy clearer, localized error messages and improved setup documentation for enabling translations.

Note:
This PR also ensures that the test suite and translation files are in sync, preventing false negatives in CI and making it easier to maintain translation quality as the project evolves.

mahdirahimi1999 and others added 8 commits June 20, 2025 20:37
- Add comprehensive translation coverage and error aggregation to test_locale_messages.py
- Add LocaleMiddleware to test configuration
- Add new tests for token validation and localization
- Updates French and Chilean Spanish translations for several messages.
- Regenerates  files from updated  files.
- Updates the  dictionary in  to match the ground truth in the  and   files.
- Corrects capitalization for the 'user' translation to ensure tests pass.
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