Skip to content
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

Fix for untranslated plurals when using multiple domains #241

Merged

Conversation

amercader
Copy link
Contributor

When translations from different catalogs are being merged, there is a workaround to copy the plurals() function from the catalog to the combined translations object. If the locale catalog doesn't exist for a particular domain, a default value is copied, overriding the proper plurals()function. This results in the plural version of a string not being translated for languages with different plural values.

See for instance test_gettext.py::test_plurals_different_domains: the Japanese locale exists only in the messages domain (translations folder) but not on the myapp one (translations_different_domain folder).

First reported in ckan/ckan#8258

When translations from different catalogs are being merged, there is a
workaround to copy the `plurals()` function from the catalog to the combined
`translations` object. If the locale catalog doesn't exist for a
particular domain, a default value is copied, overriding the proper
`plurals()`function. This results in the plural version of a string not
being translated for languages with different plural values.

See for instance `test_gettext.py::test_plurals_different_domains`: the
Japanese locale exists only in the `messages` domain (`translations`
folder) but not on the `myapp` one (`translations_different_domain`
folder).

First reported in ckan/ckan#8258
@TkTech
Copy link
Contributor

TkTech commented Jun 18, 2024

Didn't get a chance to test this today as the CI tooling was out of date and had to be updated first. Will get to this tomorrow.

@TkTech TkTech merged commit f9fe46a into python-babel:master Jun 19, 2024
@TkTech
Copy link
Contributor

TkTech commented Jun 19, 2024

@amercader Looks good, but there's a failure in the tests under pypy. Looks like the tests might be depending on the ordering of the translation list, https://github.com/python-babel/flask-babel/actions/runs/9577423964/job/26405619814

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.

2 participants