Working with l10n contexts (_x etc)

Basic l10n from a .mo file generated out of PoEdit works fine.

But as soon as I introduce _x, or variants, the link breaks, because as best as I can tell, PoEdit, completely ignores the context, and does not generate the corresponding msgctxt line in the .po/.mo files.

_x, _ex and other variants are all added to the keywords, and PoEdit is finding and parsing _x() occurrences within my source code. It’s just not capturing the context and it is not generating the msgctxt line in the resulting .po file.

What’s the workaround (other than manually editing the .po or .pot file?)

2 s
2

When adding _x to the keywords, try it this way:

_x:1,2c

This tells the parser to watch out for _x and to take the first argument as msgid and the second argument as a comment, which will then be recognized as context by poEdit and inserted as msgctxt.

Oddly enough, my poEdit then shows me the msgid twice in the “new/old” messages window. However, in the messagelist everysthing is correct then.

Leave a Comment