Commit Graph

17 Commits

Author SHA1 Message Date
Taavi Sangel
0aef81f4e9 added test for multiline msgctxt #31 2017-12-04 13:53:16 +02:00
Ruben Vermeersch
b9394176b1 Handle extracted comments in headers 2015-08-20 15:12:56 +02:00
Ruben Vermeersch
63c4209cd5 Clean up test names 2015-07-17 10:35: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
Ruben Vermeersch
656bfd0b8d Add JSCS, fix style. 2014-06-19 14:16:30 +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
8d40e1b3c4 unify string quotes 2014-06-17 21:19:14 +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