PO Filter doesn't handle "nplurals=1; plural=0" correctly

Issue #481 resolved
Chase Tingley created an issue

The attached file throws an exception in the PO filter, due to incorrect handling of plural forms.

The plural header in this file looks like this:

  "Plural-Forms: nplurals=1; plural=0;\n"

This is valid PO; as the gettext docs read:

Some languages only require one single form. There is no distinction between the singular and plural form. An appropriate header entry would look like this:

Plural-Forms: nplurals=1; plural=0;

However, the POFilter assumes that 2+ plural forms will always be present, even if nplurals=1. This causes an exception when the expected 2nd form is not present.

net.sf.okapi.common.exceptions.OkapiIllegalFilterOperationException: Line 20: Possible missing or invalid plural form of msgstr.
    at net.sf.okapi.filters.po.POFilter.processMsgStr(POFilter.java:592)
    at net.sf.okapi.filters.po.POFilter.readItem(POFilter.java:535)
    at net.sf.okapi.filters.po.POFilter.next(POFilter.java:219)

Comments (1)

  1. Log in to comment