8000 gettext: deprecate selecting plural form by fractional numbers (part 2) · Issue #88434 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gettext: deprecate selecting plural form by fractional numbers (part 2) #88434

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

Closed
serhiy-storchaka opened this issue May 30, 2021 · 3 comments
Closed
Assignees
Labels
3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member
serhiy-storchaka commented May 30, 2021
BPO 44268
Nosy @serhiy-storchaka, @pablogsal

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-05-30.09:44:10.301>
labels = ['type-feature', 'library', '3.10', '3.11']
title = 'gettext: deprecate selecting plural form by fractional numbers (part 2)'
updated_at = <Date 2021-05-30.19:03:22.590>
user = 'https://github.com/serhiy-storchaka'

bugs.python.org fields:

activity = <Date 2021-05-30.19:03:22.590>
actor = 'pablogsal'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2021-05-30.09:44:10.301>
creator = 'serhiy.storchaka'
dependencies = []
files = []
hgrepos = []
issue_num = 44268
keywords = []
message_count = 2.0
messages = ['394762', '394776']
nosy_count = 2.0
nosy_names = ['serhiy.storchaka', 'pablogsal']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue44268'
versions = ['Python 3.10', 'Python 3.11']

Linked PRs

@serhiy-storchaka
Copy link
Member Author

Non-integer numbers in GNUTranslations.ngettext() are deprecated since 3.7 (see bpo-28692 for rationale). But I forget to add deprecation warning for default implementation (which just tests n == 1) and forget to add the "deprecated" directive in the module documentation. So currently

    gettext("Elapsed: %s second", "Elapsed: %s seconds", 1.25)

will emit a warning if there is a translation for these strings, and no warnings if it is not translated yet, or translation file is not found, or null translation is used.

It is now time to convert warnings to errors, but it would be error-prone since many developers do not have translations yet when write a code or use no translation (and fallback to hard-coded English).

The safest way is to add deprecation warnings also for default and fallback implementation before turning all of them into errors. Pablo, can we add these warnings in 3.10?

@serhiy-storchaka serhiy-storchaka added 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 30, 2021
@pablogsal
Copy link
Member

Pablo, can we add these warnings in 3.10?

Thanks for checking! Yeah, I think it makes sense to go ahead adding these warnings to 3.10 . Please, add me as a reviewer to the backport PR to 3.10.

@serhiy-storchaka
Copy link
Member Author

While working on this issue I have found that stacklevel for the existing deprecation warning does is not always correct and that the code where new warnings will be added is not tested at all. So I opened a separate issue #110519 for this because these changes are worth to be backported.

@serhiy-storchaka serhiy-storchaka moved this to In Progress in Gettext issues Oct 9, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 9, 2023
< 8000 div class="pr-1 d-md-inline-block d-none">
…gettext if translation not found
serhiy-storchaka added a commit that referenced this issue Oct 14, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Gettext issues Oct 14, 2023
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
Status: Done
Development

No branches or pull requests

2 participants
0