Generating .pot file using the i18n tools

Things you need to install:

1. xgettext package

2. Check if you have set the path and environment variables in Windows for php.

If not then do this:

  • Right click My Computer shortcut
  • Click Properties
  • Click Advance system settings
  • In the System Properties window, click on the Advanced tab
  • Click the Environment Variables button
  • In the User variables section  highlight the Path variable
  • Click the Edit button.
  • Append a semicolon followed by the path to your PHP installation. For example: “C:\Winnt\System32;C:\PHP”.

Things you need to download:

WordPress i18n tools directory from SVN by issuing:

svn co


  1. Create folders “tools” and “i18n” in your root wordpress installation:
    and put all files into i18n folder.
  2. Create a softlink from actual WordPress root to src.
    mklink /J c:\folder\folder\web\wordpress\src c:\folder\folder\web\wordpress
    If it doesn’t work just make a copy of WordPress root’s files to src folder.
  3. Open cmd.
    Go to \web\wordpress\tools\i18n\ and run the makepot.php script:

php makepot.php <target> <directory>

for example:

where <target> is “wp-plugin” for a plugin or “wp-theme” for a theme

php makepot.php wp-theme ..\..\src\wp-content\themes\my-theme
php ~\public_html\wordpress\tools\i18n\makepot.php wp-theme ..\..\src\wp-content\themes\my-theme

New .pot file should appear in the web\wordpress\tools\i18n folder.



wordpress codex

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.