Commit Graph

20 Commits

Author SHA1 Message Date
Taavi Sangel
0aef81f4e9 added test for multiline msgctxt #31 2017-12-04 13:53:16 +02:00
janhommes
a6937bb7f0 Fixed issue with plural multiline text. 2017-09-14 14:37:45 +02:00
rosston
0e3a6d74f3 Stub out missing translations according to language plurals. 2017-03-08 10:24:51 -05:00
rosston
115459160e Use msgstr[0] when stringifying an untranslated plural item. 2017-02-10 10:18:01 -05:00
Julian Bäume
ba9a2db453 add examples for po files without any headers
those should at least be fixed
2015-09-22 10:38:43 +02:00
Julian Bäume
d1be0f51b0 fix issue #16
add a blank line in the comments of the headers of the big.po file. This
breaks parsing the headers. msgcat of gettext tools just ignores empty
lines until a header is found and treats everything above as header
comment.

The change to the library itself fixes the tests again, after the blank
linke broke 3.
2015-09-21 09:13:43 +02:00
Ruben Vermeersch
b9394176b1 Handle extracted comments in headers 2015-08-20 15:12:56 +02:00
Julian Bäume
cfc9b2ae82 add tests to better document reference comments
pofile does not process reference comments in any way, since the format of
references is not exactly specified. This test specifies, what users of
pofile can expect the library to do.
2014-08-12 17:47:47 +02:00
Julian Bäume
e1742e66a6 properly escape all unprintable characters
writing messages should no be in line with gettext tools. I tested
using msgcat, it provides the same results.

For some common use-cases I wrote explicit tests, for uncommon and
even unwanted use-cases I wrote one test to make sure pofile works
like msgcat for those messages
2014-06-23 18:24:02 +02:00
Julian Bäume
08e7db58b3 handle empty comments correctly
since the lines in the parser have all newline characters removed, \s+ will
not match empty comments.

Added an example that makes other tests fail without this patch.
2014-06-19 17:04:03 +02:00
Julian Bäume
e164fcfe9d new implementation of items marked obsolete
the current implementation of items marked obsolete did not allow "plain"
comments for these items. However, this is perfectly fine according to
the original gettext tools. When writing a po file, comments for obsolete
items don't contain the '#~ ' mark (tested using msgcat), so this is now
also aligned with the behaviour of the original gettext tools.

For all these cases I added examples in the po files, that failed with the
current implementation and work fine after these changes.
2014-06-19 13:47:30 +02:00
Julian Bäume
73b267b3e8 add support for multiline string in headers
Some languages (such as Polish, Russian or Romanian) do have more
complicated plural forms. Those are still expressible by a more
complicated mathematical expression. However, the msgmerge tool of
gettext will in these cases write multiline header fields. When parsing
such files with this lib, the headers get screwed up, so this patch
provides an example (from a pl_PL po file) and fixes this by joining the
lines in the header, before doing the actual parsing.
2014-03-21 10:54:32 +01:00
Ruben Vermeersch
d426c114c7 Add support for obsolete items to fix broken parsing. 2014-03-07 10:15:50 +01:00
Julian Bäume
851a87ebf2 add some real world examples for c-strings in po files
make sure, if a file containing c-string messages is identical after being
parsed and written afterwards.
2014-03-05 11:37:48 +01:00
Gabe Gorelick
ac85ba0b9c Handle extracted comments 2014-03-02 13:17:20 -05:00
Julian Bäume
6790bfb466 add parsing support for msgctxt field of poitems
The gettext format specifies a msgctxt field for translated items. An
example of how to use this field has been added to the tests and the
parsing of this attribute has been implemented.
2014-01-21 15:05:58 +01:00
Ruben Vermeersch
fff8349e25 Parse item flags. 2013-12-17 15:04:44 +01:00
Ruben Vermeersch
b2e53d790b Test references. 2013-12-17 14:56:47 +01:00
Ruben Vermeersch
5ce49c6201 Add more tests for parsing. 2013-12-17 14:53:59 +01:00
Ruben Vermeersch
ac519bfaf5 Start adding a real unit test framework. 2013-12-17 14:37:17 +01:00