oscarotero/Gettext — pull request #18 by leom (2014-07-21 13:38:48+00:00)
Title: Fixes problem with multi-line format in po headers; Jed generator now supports multiple domains; Jed generator no longer hard coded to english

Hi,

Thanks so much for this project! It's done wonders to get us ready for our pending javascript i18n conversion. However we did have to do a couple changes in order to support our needs.

When trying to extract our gettext files to the Jed format, I quickly discovered that the Jed format was hardcoded to english - which was undesirable. To fix this, I decided that the best way to set the language used is using the language header that's available within a po file.

While fixing this, I discovered that the extractor does not properly parse the headers if they end up in a multi-line string format (something that POEdit likes to do), this required full header validation - which was serendipitous as it paved the way for supporting multiple domains simultaneously (the entire reason I started poking around in the code in the first place!) Anyway, multiple domains was added through the support of a new, custom header called "X-Domain:".

If the "Language:" or "X-Domain:" headers aren't found, it will default to its previous behavior so this shouldn't impact any preexisting code. I've added supporting tests around this functionality, and all the preexisting tests pass.

Please let me know if you have any comments or concerns!

Best,
leo