Skip to content

gettext() cannot find translations with plural forms #62519

Closed

Description

@jwilk
mannequin
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

    Activity

    1. jwilk commented on Jun 27, 2013

      jwilkmannequin
      MannequinAuthor

      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'
    2. added
      stdlib
      on Jun 27, 2013
    3. BreamoreBoy commented on Oct 5, 2014

      BreamoreBoymannequin
      Mannequin

      @martin can you comment on this please.

    4. added
      type-bug
      on Oct 5, 2014
    5. gbassiere commented on May 7, 2020

      gbassieremannequin
      Mannequin

      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

    6. added
      3.8 (EOL)
      3.9 (EOL)
      3.10 (EOL)
      on Jun 9, 2020
    7. transferred this issue fromon Apr 10, 2022
    8. added a commit that references this issue on Jul 23, 2023
    9. added 2 commits that reference this issue on Jul 23, 2023
    10. added a commit that references this issue on Jul 23, 2023
    11. added a commit that references this issue on Jul 23, 2023
    12. added a commit that references this issue on Jul 24, 2023
    13. added 2 commits that reference this issue on Jul 25, 2023
    14. ambv commented on Jul 31, 2023

      @ambv
      Contributor

      This is now fixed. Thanks! ✨ 🍰 ✨

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)3.7 (EOL)3.8 (EOL)3.9 (EOL)stdlibtype-bug

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions