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

gettext() cannot find translations with plural forms #62519

Closed
jwilk mannequin opened this issue Jun 27, 2013 · 4 comments
Closed

gettext() cannot find translations with plural forms #62519

jwilk mannequin opened this issue Jun 27, 2013 · 4 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@jwilk
Copy link
Mannequin

jwilk mannequin commented Jun 27, 2013

BPO 18319
Nosy @loewis, @warsaw, @Cito, @jwilk, @gbassiere
PRs
  • bpo-18319: gettext() can retrieve a message even if a plural form exists #19869
  • Files
  • test.mo
  • 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 2013-06-27.22:53:23.400>
    labels = ['type-bug', '3.8', '3.9', '3.10', '3.7', 'library']
    title = 'gettext() cannot find translations with plural forms'
    updated_at = <Date 2020-09-18.20:39:10.360>
    user = 'https://github.com/jwilk'

    bugs.python.org fields:

    activity = <Date 2020-09-18.20:39:10.360>
    actor = 'cito'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2013-06-27.22:53:23.400>
    creator = 'jwilk'
    dependencies = []
    files = ['30717']
    hgrepos = []
    issue_num = 18319
    keywords = ['patch']
    message_count = 3.0
    messages = ['191967', '228601', '368346']
    nosy_count = 6.0
    nosy_names = ['loewis', 'barry', 'cito', 'jwilk', 'python-dev', 'Gilles Bassi\xc3\xa8re']
    pr_nums = ['19869']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue18319'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

    Linked PRs

    @jwilk
    Copy link
    Mannequin Author

    jwilk mannequin commented Jun 27, 2013

    gettext() cannot find translations for messages that have plural forms. I would expect that gettext(s) is equivalent to ngettext(s, s, 1) for such messages, as it is implemented in GNU gettext.

    >>> import gettext
    >>> with open('test.mo', 'rb') as mo: trans = gettext.GNUTranslations(mo)
    ... 
    >>> trans.ngettext("egg", "eggs", 1)
    'Ei'
    >>> trans.gettext("egg")
    'egg'

    @jwilk jwilk mannequin added the stdlib Python modules in the Lib dir label Jun 27, 2013
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Oct 5, 2014

    @martin can you comment on this please.

    @BreamoreBoy BreamoreBoy mannequin added the type-bug An unexpected behavior, bug, or error label Oct 5, 2014
    @gbassiere gbassiere mannequin added the 3.7 (EOL) end of life label May 1, 2020
    @gbassiere
    Copy link
    Mannequin

    gbassiere mannequin commented May 7, 2020

    Hi there,

    I worked on a patch for this issue (see attached pull request).

    I would be happy to discuss it with people involved in gettext module maintenance but I'm not sure how to contact them. Is there a dedicated mailing list or an IRC channel or something? I've found i18n-sig but it has been inactive for 5 years...

    Best regards
    Gilles

    @remilapeyre remilapeyre mannequin added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Jun 9, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    ambv added a commit that referenced this issue Jul 23, 2023
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 23, 2023
    …found (pythonGH-107118)
    
    (cherry picked from commit b3c34e5)
    
    Co-authored-by: Tomas R <tomas.roun8@gmail.com>
    Co-authored-by: Łukasz Langa <lukasz@langa.pl>
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 23, 2023
    …found (pythonGH-107118)
    
    (cherry picked from commit b3c34e5)
    
    Co-authored-by: Tomas R <tomas.roun8@gmail.com>
    Co-authored-by: Łukasz Langa <lukasz@langa.pl>
    jtcave pushed a commit to jtcave/cpython that referenced this issue Jul 23, 2023
    …found (python#107118)
    
    Co-authored-by: Łukasz Langa <lukasz@langa.pl>
    mementum pushed a commit to mementum/cpython that referenced this issue Jul 23, 2023
    …found (python#107118)
    
    Co-authored-by: Łukasz Langa <lukasz@langa.pl>
    carljm added a commit to carljm/cpython that referenced this issue Jul 24, 2023
    * main: (73 commits)
      Thoroughly refactor the cases generator (python#107151)
      Docs: Add missing markup to Argument Clinic docs (python#106876)
      pythongh-107162: Document errcode.h usage in its comment (python#107177)
      pythongh-106320: Remove private _PyDict C API (python#107145)
      Fix PyVectorcall_Function doc versionadded (python#107140)
      Docs: Remove duplicate word in Argument Clinic howto heading (python#107169)
      pythongh-107017: Change Chapter Strings to Texts in the Introduction chapter. (python#107104)
      pythongh-106320: Remove private _PyObject C API (python#107159)
      Docs: fix typo in os.pwrite docstring (python#107087)
      pythongh-105291: Add link to migration guide for distutils (python#107130)
      pythongh-106948: Docs: Disable links for C standard library functions, OS utility functions and system calls (python#107062)
      pythongh-106320: Remove _PyBytes_Join() C API (python#107144)
      pythongh-106320: Remove private _PyObject C API (python#107147)
      pythongh-106320: Remove _PyTuple_MaybeUntrack() C API (python#107143)
      pythongh-106320: Remove _PyIsSelectable_fd() C API (python#107142)
      Remove superflous whitespaces in `layout.html`. (pythonGH-107067)
      pythongh-107122: Update what's news for dbm.*dbm.clear() method (pythongh-107135)
      pythongh-107122: Add clear method to dbm.ndbm module (pythongh-107126)
      pythongh-62519: Make pgettext search plurals when translation is not found (python#107118)
      pythongh-107122: Add clear method to dbm.gdbm.module (pythongh-107127)
      ...
    serhiy-storchaka pushed a commit that referenced this issue Jul 25, 2023
    … found (GH-107118) (GH-107134)
    
    (cherry picked from commit b3c34e5)
    
    Co-authored-by: Tomas R <tomas.roun8@gmail.com>
    Co-authored-by: Łukasz Langa <lukasz@langa.pl>
    serhiy-storchaka pushed a commit that referenced this issue Jul 25, 2023
    … found (GH-107118) (GH-107133)
    
    (cherry picked from commit b3c34e5)
    
    Co-authored-by: Tomas R <tomas.roun8@gmail.com>
    Co-authored-by: Łukasz Langa <lukasz@langa.pl>
    @ambv
    Copy link
    Contributor

    ambv commented Jul 31, 2023

    This is now fixed. Thanks! ✨ 🍰 ✨

    @ambv ambv closed this as completed Jul 31, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    Status: Done
    Development

    No branches or pull requests

    1 participant