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

Modify gettext to look through plural translations #5105

Merged
merged 2 commits into from
Oct 6, 2021

Conversation

tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Oct 5, 2021

Closes #5073

This is kind of a hacky solution so I'm open to suggestions..

Basically, the problem is that if there is a plural translation ,e.g.,

# Polish
msgid "Convener"
msgid_plural "Conveners"
msgstr[0] "Lider"

the only way to translate Convener to Lider is to use ngettext(..., 1). gettext ignores
the plural translations when looking for a translation.
The solution is to use our own gettext with a fallback to ngettext if a translation is not found.

I don't know if this 100% foolproof as there might be some languages where a normal translation
differs from its singular translation when used with numbers.

Copy link
Member

@ThiefMaster ThiefMaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having a unit test for this would be useful.

indico/util/i18n.py Outdated Show resolved Hide resolved
indico/util/i18n.py Outdated Show resolved Hide resolved
@tomasr8 tomasr8 force-pushed the gettext-plurals branch 2 times, most recently from 087611c to 608aba1 Compare October 5, 2021 14:28
@tomasr8 tomasr8 force-pushed the gettext-plurals branch 2 times, most recently from 7f65805 to 703a4cc Compare October 5, 2021 15:19
@ThiefMaster ThiefMaster changed the base branch from master to 3.0.x October 6, 2021 08:41
It's different from a session convener, and in some languages they are
translated differently
@ThiefMaster ThiefMaster merged commit 23cc6bd into indico:3.0.x Oct 6, 2021
@ThiefMaster ThiefMaster deleted the gettext-plurals branch October 6, 2021 08:49
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.

"Convener" tag name not localizable
2 participants