Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

5 Answers 5

up vote 4 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
    
Thank you that did the trick! –  user1981248 Jun 11 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

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 is from an answer I recently did. You can check it out here

To create a po file with poedit, follow the following steps. Please note that my poedit is in Afrikaans.

Open poedit and select the option to create a catalogue. The following screen will appear

image1.

Fill in the required fields as shown.

Now click "Sources paths" tab and complete as shown. Use . in the "Paths" field if your language file is in the main directory, and use .. if the language file is in a folder like language

image2

Now click the "Sources keywords" tab and fill in as shown.

image3

Now save the poedit file as en_US.po in your languages file. It is important that you save the po file directly in the location where it must be, otherwise it will not work. Poedit will now search and add all strings for translation to your po file. A mo file is automatically created when the po file is saved.

At the end, your po header should look like this

 msgid ""
msgstr ""
"Project-Id-Version: Transparent v1.2\n"
"POT-Creation-Date: 2014-03-12 16:25+0200\n"
"PO-Revision-Date: 2014-03-12 16:28+0200\n"
"Last-Translator: Pieter Goosen <goosen_p@yahoo.com>\n"
"Language-Team: Transparent <sample@example.com>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.5.5\n"
"X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-SearchPath-0: ..\n"

For further reading, check this tutorial. It really helped me when I started on translations. Hope this helps.

share|improve this answer

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

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.