WordPress translation

website creator

Generate .pot file for a theme or plugin with Poedit tool

  • File -> New Catalog
  • Project Name and Version -> "some_name"
  • Charset = "UTF-8"
  • Source code charset = "UTF-8"
  • Sources path tab -> Base path = "./" (if searching strings in the parent catalog)
  • Paths = ".." (if searching strings in the parent catalog) (use "." if searching strings in the same catalog)
  • Sources keywords -> Keywords -> add "__" and "_e"

<?php printf( __( 'Proudly powered by %s', 'twentytwelve' ), 'WordPress' ); ?>

or just return

<?php echo sprintf( __( 'Proudly powered by %s', 'twentytwelve' ), 'WordPress' ); ?>

Use Poedit to translate WordPress themes or plugins. Poedit helps to create and edit ".po" and ".mo" files.


msgid ""

msgstr ""

"Project-Id-Version: site\n"

"POT-Creation-Date: 2013-01-09 18:18+0200\n"

"PO-Revision-Date: 2013-01-09 19:37+0200\n"

"Last-Translator: \n"

"Language-Team: site.com \n"

"Language: ru_RU\n"

"MIME-Version: 1.0\n"

"Content-Type: text/plain; charset=UTF-8\n"

"Content-Transfer-Encoding: 8bit\n"

"X-Generator: Poedit 1.5.4\n"

"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"

"X-Poedit-Basepath: .\n"

"X-Poedit-SourceCharset: UTF-8\n"

"X-Poedit-SearchPath-0: .\n"

If you're want to help the WordPress community, you can translate WordPress core or other WordPress projects into your language.

Creating POT Files

See also: Generating POT files for Plugins and Themes

  1. Start POEdit
  2. Click File -> New Catalog
  3. Enter a project name (probably your plugin's file name)
  4. Click the Paths tab at the top
  5. Click the New Item icon (second one, looks like a little square)
  6. Enter the path to the directory containing your plugin file ("." tells POEdit to scan the directory that you will save the file to), press enter
  7. Click the Keywords tab at the top
  8. Click the New Item icon
  9. Enter __ (that's underscore underscore), press enter
  10. Click the New Item icon
  11. Enter _e (that's underscore e), press enter
  12. Click Okay
  13. Choose a name for your .po file (probably your plugin's base filename)

The Update Summary window should display, with a list of strings that were found to translate, based on the keywords supplied above (__ and _e). Click Okay.

Save the .po file, and exit the program.

Make the .po file available for download (or optionally include it in the plugin archive). Translators will use this file to construct a .mo file, which will be used by the load_plugin_textdomain() function.

Leave a Comment