1. David Jean Louis
  2. polib
  3. Issues
Issue #15 invalid

polib can not process plural

Anonymous created an issue

If there is one like this:

. translators:

. * The number of sound outputs on a particular device

: ../gnome-volume-control/src/gvc-mixer-control.c:1094

, c-format

msgid "%u Output" msgid_plural "%u Outputs" msgstr[0] "%u 输出"

polib will not return a msgid = '%u Outputs' and for msgid='%u Output',it return the msgstr=''

Comments (2)

  1. David Jean Louis repo owner

    Your assumption on how polib handles plural is wrong, here's how it works:

    po test file

    msgid ""
    msgstr ""
    
    msgid "%u Output"
    msgid_plural "%u Outputs"
    msgstr[0] "%u 输出"
    

    Python API

    >>> import polib
    >>> po = polib.pofile('test.po')
    >>> po[0].msgid
    u'%u Output'
    >>> po[0].msgid_plural
    u'%u Outputs'
    >>> po[0].msgstr
    u'' # normal
    >>> po[0].msgstr_plural
    {u'0': u'%u \u8f93\u51fa'}
    >>> print unicode(po[0].msgstr_plural['0'])
    %u 输出
    
  2. Log in to comment