-
Notifications
You must be signed in to change notification settings - Fork 693
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
base: master
Are you sure you want to change the base?
Improve Translation Coverage, Localization Tests, and Documentation for i18n #918
Conversation
Thank you! You will need to rebase first. |
- 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
for more information, see https://pre-commit.ci
- 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.
d0cfd75
to
f81d212
Compare
You're welcome! Done. |
I’ve done the rebase, this PR is now updated @Andrew-Chen-Wang |
tests/test_locale_messages.py
Outdated
@@ -0,0 +1,1017 @@ | |||
import os |
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.
This file is unreviewable. We'd have to update this all the time, and there isn't really a need to test for these messages.
@@ -0,0 +1,491 @@ | |||
import importlib |
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.
same with this file
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.
Hi, thanks for the feedback. I see your point about the extra work to maintain these test files.
The main reason I added them was to fix the bugs in this PR. In fact, many of the corrections in the .po
and .mo
files were identified by running these exact tests. They now work as a safety net to catch similar issues in the future.
By keeping tests/test_locale_messages.py
and test_token_validation_and_localization.py
, we can make sure that future translation updates won't accidentally break the API for users.
It's a small step to prevent bigger problems down the road, and that's why I think keeping them is a good idea.
Hi I can accept the translation fixes, but it is obvious you are using AI to generate these test files and PR. It's fine to use AI, but there isn't human-centric thinking going behind those test files. There is no way we'd update the test files because they rely on making sure we update the translations and the test files. |
Hi, thank you for the detailed feedback! I'd like to clarify that none of these tests were generated by AI; they were all written manually. For reference and to show my approach to contributions, here are some of my other pull requests in this and similar projects:
Regarding the very problem you pointed out—that the test files need to be updated whenever the translation files change—that was actually an intentional design. The idea was to require that users who modify the translations must also update the corresponding test file. This approach allows us to track which parts of the translations have changed and to identify any potential "breaking changes." However, I understand your perspective and will follow your guidance. As you suggested, I will remove these two files from this pull request. |
In OSS, getting volunteers for translations/contributions in general is very tough. Asking for too much would be a burden. Thanks for understanding. |
@Andrew-Chen-Wang |
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:
.po
files, and every language declared in constants has a corresponding translation file. This prevents missing translations in production.ALGORITHM
) and token validation errors.2. Translation Improvements
fr
):.po
file (Utilisateur
).es_CL
):.po
file (Usuario
).fa
,fa_IR
):nl_NL
):3. Test Dependency Update
polib
tosetup.py
test dependencies to enable.po
file parsing in tests and CI environments.4. Documentation Updates
LOCALE_PATHS
.Impact
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.