7

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?)

  • Is this a WordPress issue, or something with POEdit? I've generated plenty of translation files from WordPress Plugins/Themes, but, as far as I know, none that use a translation context. Does this happen only in POEdit, or using other translation tools, as well? – Chip Bennett Oct 16 '13 at 17:20
  • Hey Chip, I hear you, and to be honest, I'm pretty sure this has nothing whatsoever to do with WordPress. So why post here, right? It's just that it seems like such a common issue in the WP community that someone must have come across it already. I hope you won't recommend removing the question as a result - I do think it's quite relevant to the WP SE. – Tom Auger Oct 16 '13 at 21:12
17

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.

  • 1
    This is the right answer for the _x function but the author of the question named _ex too. Maybe you'd like to add some more information here. I find the post WordPress – Poedit: Translation Secrets very useful regarding this issue. – realloc Nov 12 '13 at 16:30
0

In your poedit project settings, add _x to the keywords

http://wp.tutsplus.com/tutorials/theme-development/translating-your-theme/

  • Thanks for your comment. I should have specified in my original post that I AM adding _x, _ex and other variants to the keywords. – Tom Auger Oct 16 '13 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.