1. David Jean Louis
  2. polib
  3. Issues
Issue #24 resolved

Support indented PO files

Anonymous created an issue

Some of polib's checks to determine the context of a token is based on hard-coded strings like 'msgid "'.

Unfortunately, those checks cannot take into account indented PO files (-i option in gettext) where there may be more than a single space between "msgid" and the opening quote.

This is true for most tokens (msgctxt, msgid, msgstr, msgid_plural). I'm not sure about special comments like "#| msgid", though I'd suggest supporting multiple spaces there too, to make polib more lax about its inputs.

Comments (3)

  1. François Poirotte

    Attached is a patch against polib 0.6.3 that supports whitespaces (tabs or spaces) after a keyword (eg. msgid) and after a special comment marker (such as "#|"). It should apply cleanly against the trunk as well.

    I added a testcase for this feature/bug (tests/test_indented.po).

    Also, polib 0.6.3 was missing tests/test_wrap.po, so I downloaded it separately. All tests pass.

  2. Log in to comment