Closed Connum closed 4 years ago
Which version of gettext-parser are you using?
The latest version on npm, 4.0.2
Or is Poedit simply violating some standards regarding header naming convention in pot files?
Poedit developer here: GNU gettext headers are case sensitive. E.g. changing Language
to language
will cause all GNU gettext tools such as msgfmt
to warn about missing Language
header.
@Connum I can't reproduce this with 4.0.2.
Previous versions had this behavior though. Can you please make sure (npm ls gettext-parser
) you are not using multiple versions?
Since v4 custom headers should not be touched. Only for a fixed list of predefined gettext headers casing is enforced.
Please feel free to send a PR containing a test that replicates this behavior. Or at least attach a valid PO(T) file. I'll investigate further.
Ha! I'm also using the package po2json and it turns out I missed that it's using gettext-parser 2.0.0 as a dependency. That might be the issue, although I think I'm just using this to convert translations to jed and not for saving that data back to the pot file. I'll see if I can create a simple example repo to reproduce this.
Sorry for my stupidity and wasting your time... It was indeed a package using an older version of gettext-parser that caused the trouble.
No problem! Thanks for the update!
When parsing a pot file with this package, all header names are transformed to lowercase first, then upon saving, each letter after a dash in the name is transformed to uppercase. However, some translation software writes custom headers that are case-sensitive, like Poedit:
After handling my pot file with this package, I'm no longer able to update the translation strings from source in Poedit, because they are now written like this:
Could you add an option to keep the header names untouched (or it might be a good idea not transforming any custom headers starting with X- by default?)? Or is Poedit simply violating some standards regarding header naming convention in pot files?