3

SO I am trying to do some i18n on a plugin I am working on and having some troubles. I wanted to see if anyone else has encountered these or possibly has a solution.

Basically, I have received the plugin translation and it all looks great except for one thing: the plugin description. I tried adding into the plugin header Text Domain and Domain Path, but I cannot figure out how to get this into the .pot file for translation.

I examined a couple of plugins ( WooCommerce and Easy Digital Downloads) and I noticed that both have the string in their .pot files and it doesn't seem like they are doing anything special to get them there. I was trying this with Poedit and could not figure it out. The one thing I have not tried and maybe this will solve it is using the make .pot from WordPress, will that add in the description?

On another note with the Text Domain in the header (even for WooCommerce) I noticed that the plugin description does NOT get translated unless the plugin is actually active. Is that an issue with WordPress or is it just being done wrong?

Sorry for the long post and thank you to anyone who can contribute!o

2

You need to be using WP's own tools (makepot.php) for creating POT files for header to be properly scanned and included, see Generating a POT file in Codex.

For plugin details to be translated when inactive its header should include properly set up text domain and path to translations folder (if necessary).

  • Alright thank you, I will try generating the .pot through WP and see what happens. As far as the other part with the header, I believe WooCommerce is doing it correctly, yet it still only shows the translation when the plugin is active. Is that a WP issue? – Nick Young Mar 4 '14 at 23:51
  • @NickYoung well if it works in general, but not in WooCommerce my assumption would be that it's WooCommerce issue, not WordPress one. Needs looking at. – Rarst Mar 5 '14 at 8:33
  • @NickYoung looked into WooCommerce and it's simply buggy there, opened issue for them github.com/woothemes/woocommerce/issues/5073 – Rarst Mar 6 '14 at 22:26
  • Cool, thanks for the follow up on that. Very helpful to know. – Nick Young Mar 8 '14 at 3:40
  • Thank you again for this answer. I did this on a previous plugin and it worked perfectly. I am however, doing this for a second plugin and when I make POT from the WP.org admin the POT file does not include the plugin description. Any thoughts on why this could be happening? Thanks! – Nick Young Apr 25 '14 at 17:20
1
  1. Download the zip from https://github.com/wp-mirrors/wp-i18n-tools.
  2. Extract its content into the wp-includes folder.
  3. Command line one-liner from within WP root: $ php wp-includes/makepot.php wp-plugin wp-content/plugins/MYPLUGIN/ wp-content/plugins/MYPLUGIN/MYLANGFOLDER/MYPLUGIN.pot
  4. Then you take this resulting .pot file as source for Poedit.
  5. Finally ensure to name the .mo/.po like your plugin plus language code, for example: MYPLUGIN-de_DE.mo/MYPLUGIN-de_DE.po.

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.