-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-94194: gettext plural values must now be integers #94195
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
Conversation
Using non-integer value for selecting a plural form in gettext is no longer supported. It never correctly worked and was deprecated since Python 3.7.
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.
I worked on this issue, and it was more complex than just replacing warnings with exceptions. It is an interface with multiple implementations, so we perhaps need to add more warnings before making them errors.
Unfortunately I lost several hundreds of local branches and patches a week ago, so I have to start from beginning.
Oh no :-( I'm very sorry for you 😔 |
Ah? Would you mind to elaborate? Which function are you talking about? Do you want to deprecate more code paths? |
Currently only methods of |
NullTranslations does "nothing". It doesn't parse the input file. I don't see the relationship with this issue which is only about removing deprecated code.
Which global functions? I only found c2py() used by GNUTranslations._parse() to parse |
It does not do "nothing". For example: def ngettext(self, msgid1, msgid2, n):
if self._fallback:
return self._fallback.ngettext(msgid1, msgid2, n)
if n == 1:
return msgid1
else:
return msgid2 It does choose
|
This PR is about removing deprecated code in GNUTranslations. So ok, there is a code path in NullTranslations that you would like to change. But it's not deprecated yet, and it's a different class. Would you be ok to change GNUTranslations right now (this PR), and consider changing NullTranslations later? If yes, I will update the PR to clarify that the change is specific to GNUTranslations. Note: I'm not convinced that NullTranslations needs to be changed, but I don't have a strong opinion about it. |
Since FWIW, flufl.i18n implements a stack of translations for web-based applications (as opposed to single invocation CLIs) like Mailman which need multiple active translation contexts at any one time. |
No. I would did it a year ago if it be so simple. See #88434. Adding deprecations which cover all paths (including third-party implementations) and only produce one warning per call is a bit tricky. |
Sorry but I don't have the bandwidth to investigate on how to rework deeply gettext to handle the issue in every possible code path. My plan was only to change the few lines related to the current DeprecationWarning. If someone is more motivated than me, please go ahead. You can freely copy my code ;-) Get it as a patch. I just close my PR. |
Using non-integer value for selecting a plural form in gettext is
no longer supported. It never correctly worked and was deprecated
since Python 3.7.