Commit Graph

18 Commits

Author SHA1 Message Date
Andréas Livet
18a4cc0cb5 Add test to ensure no spaces are added on empty comments 2017-03-20 10:20:04 +01: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
Ruben Vermeersch
b9394176b1 Handle extracted comments in headers 2015-08-20 15:12:56 +02:00
Ruben Vermeersch
104d114d5d Only write flags when they evaluate to true. 2015-07-17 10:35:25 +02:00
Julian Bäume
d8fc514359 don't remove \n characters from written po file
in Item.toString, all \n characters are removed from the output.
The gettext tools however leave those characters intact. This
will now produce the same output as tools like msgcat.
2014-06-23 15:03:58 +02:00
Julian Bäume
af94d8ff5e restore previous behaviour with \n in strings
An incompatible change (that actually breaks po parsing after writing) had
been introduced with commit e164fcfe9d. If
_process returned an array (which is the case for strings containing \n
character), array.toString will return a comma separated list, which is not
valid po syntax. Added a test to restore the behaviour from before the
e164fcfe9d.
2014-06-23 12:30:04 +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
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
Julian Bäume
94f5f4a83e add reverse method of extract(string)
during PO.parse, an extract(string) method is called on each string to
unescape some characters (like " and \). This process should be reverted
in the toString method.

The PO spec says, that all strings should be C-Strings. Otherwise tools
like msgmerge (from the gettext package) will fail parsing po files written
by this library.
2014-03-05 10:13:30 +01:00
Gabe Gorelick
ac85ba0b9c Handle extracted comments 2014-03-02 13:17:20 -05:00
Gabe Gorelick
ada76116b0 Include comments in PO.Item output
Fixes #5
2014-03-02 12:41:40 -05:00
Julian Bäume
a5f3059661 fix default value of msgctxt field
I added a few more edge-cases to the tests for the new msgctxt field and
revealed a bug during that. The default value has been set to empty
string, but should have been null, since the spec says, this field is
optional.
2014-01-22 14:14:03 +01:00
Julian Bäume
c046b62873 implement writing msgctxt field
since the parser can extract this information, now, the writer should
also be able to write it back to a po file
2014-01-21 15:06:11 +01:00
Ruben Vermeersch
6b2cb2e71e Stop using util.format.
This will massively shrink the browserified footprint.
2013-12-18 16:46:09 +01:00
Ruben Vermeersch
0d4f80e7f6 Write flags out when serializing. 2013-12-17 16:35:40 +01:00