Issue #29 on hold

When process entry with "#. " above it, error occoured

Anonymous created an issue

such like {{{

!gettext

. translators: reverse the order of these arguments

. * if the kicked should come before the kicker in your locale.

.

: ../libempathy-gtk/empathy-chat.c:2729

, c-format

msgid "%1$s was kicked by %2$s" msgstr "%1$s 被 %2$s 踢出" }}}

Comments (5)

  1. Og Maciel

    If filename is http://l10n.gnome.org/POT/gnome-terminal.master/gnome-terminal.master.zh_TW.po which is saved locally, then:

    In [13]: po = pofile(filename, autodetect_encoding=True, encoding='utf-8') ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (607, 0)) --------------------------------------------------------------------------- IOError Traceback (most recent call last) /Library/Python/2.7/site-packages/django/core/management/commands/shell.pyc in <module>() ----> 1 po = pofile(filename, autodetect_encoding=True, encoding='utf-8')

    /Library/Python/2.7/site-packages/polib.pyc in pofile(pofile, kwargs) 100 file (optional, default: ``False``). 101 """ --> 102 return _pofile_or_mofile(pofile, 'pofile', kwargs) 103 104 # }}}

    /Library/Python/2.7/site-packages/polib.pyc in _pofile_or_mofile(f, type, kwargs) 71 check_for_duplicates=kwargs.get('check_for_duplicates', False) 72 ) ---> 73 instance = parser.parse() 74 instance.wrapwidth = kwargs.get('wrapwidth', 78) 75 return instance

    /Library/Python/2.7/site-packages/polib.pyc in parse(self) 1248 1249 else: -> 1250 self.process('??', i) 1251 1252 if self.current_entry:

    /Library/Python/2.7/site-packages/polib.pyc in process(self, symbol, linenum) 1311 self.current_state = state 1312 except Exception: -> 1313 raise IOError('Syntax error in po file (line %s)' % linenum) 1314 1315 # state handlers

    IOError: Syntax error in po file (line 2143)

    In [17]: polib.version Out[17]: '0.7.0'

    The contents for line 2143 show:

    1. . Translators: This is the label of a menu item to choose a profile.
    2. . * _%c is used as the accelerator (it will be a character between A and Z),
    3. . * and the %s is the name of the terminal profile.
    4. .
    5. : ../src/terminal-window.c:483
    6. , c-format msgid "_%c. %s" msgstr "_%c. %s"
  2. rachidbm

    I think I have almost the same problem in polib 0.7. When the .po file contains the line "#." parse() terminates with the error:

      File "/usr/lib/python2.7/dist-packages/polib.py", line 102, in pofile
        return _pofile_or_mofile(pofile, 'pofile', **kwargs)
      File "/usr/lib/python2.7/dist-packages/polib.py", line 73, in _pofile_or_mofile
        instance = parser.parse()
      File "/usr/lib/python2.7/dist-packages/polib.py", line 1250, in parse
        self.process('??', i)
      File "/usr/lib/python2.7/dist-packages/polib.py", line 1313, in process
        raise IOError('Syntax error in po file (line %s)' % linenum)
    IOError: Syntax error in po file (line 4202)
    
  3. rachidbm

    I got the same error again when the .po file contains comment like: #| It works when I changed a statement to:

    elif (tokens[0] == '#.' or tokens[0] == '#~|')  and nb_tokens >= 1:
    

    Don't know if this will break something else, but for me polib is usable again :)

  4. David Jean Louis repo owner

    I still do not reproduce this issue, all entries starting with "#." are correctly parsed. That said, "#|" fails, but this is another issue reported here: https://bitbucket.org/izi/polib/issue/28/ioerror-on-reading-obsolete-previous-msgid

    Please (o g Maciel, rachidbm) if you still reproduce the issue with "#." try to post a reproducible case with a description of your environment (os, python version, etc.). Thanks a lot !

  5. Log in to comment