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.


10 Answers 10


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.
  • Much better and easier than POEdit. Clean UI. Has all the i18n translation functions in the keyword list by default. Thank you. – Paras Shah Oct 1 '18 at 5:21
  • Used this after realizing that POEdit's WordPress features are paid. Worked perfectly! – Swen Nov 30 '18 at 16:17

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

  • This does not work for WordPress and the specific changes to the translation system. It is incomplete at best. – Otto Jan 30 '16 at 1:04
  • 1
    It worked really well for my plugin – Pablo S G Pacheco Jan 17 '17 at 15:12
  • It works for the plugin, but doesnt translate the plugin description from header – Awsme Sandy Feb 27 '18 at 6:51

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.

  • will this work for a plugin too? – Maruti Mohanty Dec 25 '14 at 6:57
  • 2
    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 '16 at 1:03
  • Awesome tools! Though it kept throwing errors like "Couldn't generate file" even though I chmod +x the directories.. – Samuel Elh Dec 22 '16 at 13:14
  • 1
    Why would chmod +x help? Maybe you should try making the directory writable instead of executable. – Otto Dec 23 '16 at 9:25

I found the easiest way now is to use the WP-CLI. Navigate to your theme or plugin and execute the following command (after WP-CLI is installed):

wp i18n make-pot . languages/my.pot

(See documentation of the command)

You can then edit this file with Poedit or any other handy translation tool.


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.

  • This does not work for WordPress and the specific changes to the translation system. It is incomplete at best. – Otto Jan 30 '16 at 1:05
  • Woot? It's a WP plugin. – certainlyakey Oct 16 '17 at 8:31

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


I have same problem, the solution is in the first tab when you extract catalog, should put UTF8 recommanded, and in the 3th tab "Sources keywords", click on the "New item" button (2nd button) and enter a keyword and repeat this for each of your keywords (__, _e).


As Otto said :

For Mac users, I would do something like :

  • After installed by svn co http://develop.svn.wordpress.org/trunk/ wpdev


  • Make /languages/ dir on your theme
  • Make a command file like lang.command in that /languages/ dir
  • Inside lang.command

add code something like this..

cd $(dirname "$0")
php /Users/YOUNAME/wpdev/tools/i18n/makepot.php wp-theme ../../mytheme mytheme.pot

PS: Change your correct makepot.php path and mytheme to your theme name

Now everytime you want to make a new .POT file, you can just ran lang.command



Script auto create .po file, auto add all text from you code

  1. Add load_theme_textdomain('my-textdomain',DIR.'/languages/');
  2. Create folder wp-content/themes/MY_THEME/languages (add your language .mo file to this folder)
  3. Create po.php and add this script:
<?php /*Script by Sien.com.vn */
define('WP_USE_THEMES', true);

require(''.$_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );

function title_p($title) {

$title='Po create';   

return $title;}
add_filter( 'pre_get_document_title', 'title_p' );



echo '<div id="content" class="col col-100">';


function write_txt($path,$content,$type){
$file=fopen($path,$type) or die();
return TRUE;





function sfile($dir, $ext) {
    global $textdomain;

$globFiles = glob("$dir".DIRECTORY_SEPARATOR."*.$ext");
$globDirs = glob("$dir/*", GLOB_ONLYDIR);

foreach ($globDirs as $dir) {
sfile($dir, $ext);


foreach ($globFiles as $file=>$path) {





foreach(array_unique($output[1]) as $v){





foreach(array_unique($k) as $v){


msgid "'.$v.'"
msgstr ""
msgid "'.$v.'"
msgstr "'.__($v,'this_lang').'"



if(empty(file_get_contents(''.__DIR__.'/po.dat.isset')) && empty(file_get_contents(''.__DIR__.'/po.dat.empty'))){
        echo '<div class="error">Error, Textdomain <b>'.$textdomain.'</b> not found!</div>';

write_txt(''.__DIR__.'/'.$lang_code.'.po','# '.$lang_code.' LANG
msgid ""
msgstr ""
"PO-Revision-Date: 2017-11-23 22:26+0700\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 2.0.4\n"
"Language: vi_VN\n"
"Project-Id-Version: Sien\n"
"POT-Creation-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"


echo '<div class="success"><span style="color:blue">Success</span> -> Saved to: '.__DIR__.'/ <b>'.$lang_code.'.po</b></div>';




echo '<form action="" method="POST">
<div class="menu bd text-center"><p>Language: <select name="lang">';

foreach(glob("".__DIR__."/*.mo") as $path) {echo '<option value="'.$path.'">'.pathinfo($path,PATHINFO_FILENAME).'</option>';}

echo '</select></p>';

function stext($dir, $ext) {
$globFiles = glob("$dir".DIRECTORY_SEPARATOR."*.$ext");
$globDirs = glob("$dir/*", GLOB_ONLYDIR);
foreach ($globDirs as $dir) {stext($dir, $ext);}

foreach ($globFiles as $file=>$path) {
$txt.=(str_replace(' ','',file_get_contents($path,FILE_USE_INCLUDE_PATH)));


foreach($gtextdomain[2] as $text){

    $td.='<option value="'.$text.'">'.$text.'</option>';



if(empty($textdomain)){echo '<div class="error">Not found textdomain [ <b>load_theme_textdomain ("you-textdomain","path_to_language_folder");</b> ]</div>';}else{
echo '<p>Textdomain: <select name="textdomain">'.$textdomain.'</select></p>';

echo '<p>
<input type="submit" value="Create new.po file"/>



echo '</div>';

  1. Go to youdomain/wp-content/themes/MY_THEME/languages/po.php and create .po file
  2. Copy wp-content/themes/MY_THEME/languages/[LANG].po to desktop and open with Poedit -> Compile MO -> copy [LANG].mo to languages folder

Use as echo __('This text','you-textdomain');


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

  • This does not work for WordPress and the specific changes to the translation system. It is incomplete at best. – Otto Jan 30 '16 at 1:05

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.