WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've spent hours today on what seemed like something really simple, which is to create a .pot file for a Wordpress theme that I'm creating. I've read the Smashing Magazine article, the Tutsplus article and few others on how to use Poedit to create .pot files for a theme, and then create .mo and .po files, but sadly, I'm still stuck at the first step.

I installed Poedit and I find that the UI is completely different than that is shown in all of the the tutorials and it seems like there is no more an option to create .pot file. Only thing that is available is to create .po and .mo files from an existing .pot file, which is not what I need now.

So can someone please tell me how can I create .pot files using Poedit or with some other method, I would really appreciate it.

Thanks!

share|improve this question
    
Try Creating POT Files. – WisdmLabs Jan 11 at 11:34
up vote 6 down vote accepted

You may try Eazy Po.

  • From file menu select “New from source code files..”.
  • In xgettext Command Manager window; Press “Browse folder” to select base source folder.
  • In Build pane press “Execute Command” button to generate Pot file.
share|improve this answer
1  
Thank you that did the trick! – user1981248 Jun 11 '14 at 16:28

Here is how you can create a .pot file for your theme with Poedit (free edition, version 1.6.10) on OS X.

Best practise is to save language files in a folder named "languages" in your theme directory. If you haven't already, create it before you start.

In Poedit:

  1. In the "File" menu select "New"
  2. Select the language that you used in your theme (probably English)
  3. In the "Catalog" menu select "Properties"
  4. Enter the project information in the "Translation properties" tab
  5. Go to the 3rd tab "Sources keywords"
  6. Click on the "New item" button (2nd button) and enter a keyword and repeat this for each of your keywords (__, _e, esc_attr_e, etc.)
  7. Click on the "OK" button at the bottom
  8. In the "File" menu select "Save As.."
  9. Save the file as "yourthemename.pot" in the "languages" folder in your theme directory (make sure you add the .pot extension to the filename because by default it will save as .po)
  10. In the "Catalog" menu select "Properties" again
  11. Go to the 2nd tab "Sources paths"
  12. Set the value for "Base path" to ../ (the .pot file is saved in a subdirectory so this way you set the base to the parent directory, ie. your theme directory)
  13. Next to "Path" click on the "New item" button and enter . (this will make it scan your theme directory and its subdirectories)
  14. Click on the "OK" button at the bottom
  15. In the project window click on "Update" (2nd icon at the top)
  16. In the "File" menu click "Save"

And you're done :)

share|improve this answer
    
This does not work for WordPress and the specific changes to the translation system. It is incomplete at best. – Otto Jan 30 at 1:04

You can do this with the WordPress tools, without POEdit.

First, do an svn checkout of http://develop.svn.wordpress.org/trunk/:

svn co http://develop.svn.wordpress.org/trunk/ wpdev

Then, switch to the i18n tools directory in it:

cd wpdev/tools/i18n/

Then just run the makepot.php over your theme's directory:

php makepot.php wp-theme /path/to/your/theme themename.pot

This will create a themename.pot file for you. Use it in any standard translating tool you like.

This is better because it uses the WordPress code to find the i18n functions, so you won't miss any of them. Additionally, it will find and add things like the theme header information, such as the name, description, etc. This allows for those to be translated too. Make sure you include the "Text Domain:" header in your style.css for those to work.

share|improve this answer
    
will this work for a plugin too? – Maruti Mohanty Dec 25 '14 at 6:57
    
Yes, just use "wp-plugin" instead of "wp-theme" and it will generate a POT file for a plugin. – Otto Dec 25 '14 at 12:39
    
Every other method that does not use the WordPress specific tools is broken in some way. – Otto Jan 30 at 1:03

For anyone who had like to use Poedit instead of Easy Po.

  1. Download (latest version of) Poedit and Install
  2. Go to file>New. A new tab will come up, choose your language of translation and Save (ctrl + s) to the root folder of your wordpress theme.

  3. On the page you will see next, Click on - "Extract from sources". The tab you will see next is similar to those used in the links you pasted. "Project Info" is now "Translation Properties", as well as "Paths" and "Keywords" are "Sources Paths" and "Sources keywords" respectively

share|improve this answer

Try this post: Create a .pot or .po File using Poedit. It describes the workflow, and indicates .po and .pot files are the same.

By default Poedit saves your file as a .po file but since the two files are identical you can get around that by simply choosing to save the .po file as a .pot file

share|improve this answer
    
This does not work for WordPress and the specific changes to the translation system. It is incomplete at best. – Otto Jan 30 at 1:05

You can drop external tools altogether with Loco Translate plugin. I've tried it about a year ago and never used POEdit since. Install it on your test site and create POT file with one click.

share|improve this answer
    
This does not work for WordPress and the specific changes to the translation system. It is incomplete at best. – Otto Jan 30 at 1:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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