Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to translate this plugin. This plugin already has translations to some languages, and it has .pot file for adding new languages (as far as I understood from description). Although I never had an experience to work with .po .mo
So I wonder what are the main points. How to create .po .mo files and how to define that the plugin will talk a certain language, I tried to define for examble russian language, but did not find where to do this [I tried to insert define ('WPLANG', 'ru_RU'); in wp-config.php but it does not help].

share|improve this question

4 Answers

up vote 5 down vote accepted

The Editor

There are others, but this is most used: Poedit, a cross-platform gettext catalogs (.po files) editor.

The Formats

  • .mo stands for Machine Object
    -- compiled export of the .po file which is used by WordPress
  • .po stands for Portable Object
    -- editable text file with the translations strings
    -- based on the master .pot file, using Update from POT file PoEdit function
    -- some folks distribute this as a master file, but it should be used only for translations
  • .pot stands for Portable Object Template
    -- editable text file used to grab all the translatable strings from WordPress itself and Themes and Plugins, using Update from Sources PoEdit function

The Procedure

  • Duplicate the .pot file and rename it to plugin-basename-lang_COUNTRY.po
  • Example for the referenced plugin case: subscribe-reloaded-pt_BR.po
    -- pt_BR means Portuguese Brazil, but many languages don't have a country variation...
    -- you'll have to fill in with your own language
  • WPLANG in wp-config.php file must be set to your language, e.g., pt_BR
  • Every time you save the .po file, PoEdit automatically generates a .mo file, which is the one WordPress uses and basically the only one you need to upload

Observations

  • If you do a full or a decent partial translation, submit it to the plugin author so he can include it in the Repository and you get credited for it
  • Don't forget to make a backup of your translation, because if you upgrade the plugin your file will be lost
  • @user17078 plugin suggestion is quite nice, but I never used it much
  • I left the writing of this answer opened for a while and @Pippin answered in the interim, but am publishing anyway... :)
share|improve this answer

I suggest also http://poeditor.com/. It is a web-based translation tool that works great with .po, .mo, .pot and other types of files.

share|improve this answer
A visitor proposed an edit pointing to a new plugin for this service: wordpress.org/extend/plugins/poeditor – brasofilo yesterday

You will want to use POEdit. It's a free application for creating .po/.mo files.

I wrote a pretty in-depth tutorial on the entire topic here. You can skip to Step 3 - Create the Translation File For Text Domain.

share|improve this answer

try this plugin: http://wordpress.org/extend/plugins/codestyling-localization/ You can translate you plugins and themes using this.

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.