post-page

WP Translations: mo and po files

9
responses
by
 
on
March 6th, 2007
in
General, HOW-TO, WordPress, WordPress FAQs

You can install WordPress in various different languages and it is very easy to setup these translations. You can find more information on translating WordPress into your own language on the WordPress Codex. The Codex also has a lot of information on existing translated versions of WordPress and the .mo language files. They are very simple to use. You just copy the .mo file to the wp-includes/languages folder and change/add the following line to add the filename of your language translation file

define ('WPLANG', '');

to

define ('WPLANG', 'es_ES');

if your language filename is es_ES.mo I suggest making this change before you install WordPress.

This is all well and good, but this post is more about dispelling some of the myth and confusion surrounding .mo files. .mo files are not human readable by their nature and cannot be edited directly. You would need to install a version of poedit on your computer to be able to modify your language files and create new ones. There is detailed information on the Codex on where to start and what to do.

BUT .mo files can be decompiled into their .po counterparts which can then be edited using poedit. To convert .mo files into .po files, just cd to the bin directory of your poedit installation (in windows you have to use the command prompt) and use the following command

msgunfmt [path_to_file.mo] > [path_to_file.po]

Now you should be able to edit the po file created with poedit. Follow the Codex instructions at that point. You should not have to depend on anyone for the source of their .mo files if you need or want to make a change.

heading
heading
9
Responses

 

Comments

  1. Lloyd Budd says:

    Although decompiling is interesting in itself. It seems strange to focus on “you should not have to depend on anyone” at the end of the article. Sure, that is always a valid option, but are the localization communities not just that, communities? — welcoming of contributions and collaboration.

  2. Mark says:

    Lloyd: There was some GPL related questions brought to me regarding .mo files, thus this post and the suggested solution.

  3. Lloyd Budd says:

    I don’t really understand your comment, and IANAL, but if that advice was that decompiling a .mo file could allow someone to distribute the file outside of the terms that the .po file was licensed, I would consider that advice with caution because (1) “translation” is too close and likely covered by the .po’s license if it explicitly has one or (2) the distribution of the .mo is covered in another package.

  4. Mark says:

    Well, let me put it bluntly. One of the translators of WordPress is giving grief to the people looking for the source of his translation. Rather than choose conflict, I helped them extract the source of the .mo and learned a lot more about .po and .mo files. This is a tutorial based on my experiences.

  5. Hans says:

    Interesting, although I managed to download the po-file directly by using the url, too. A lot of people store it in the incluces/language directory. The part that seems difficult to me is creating a pot-catalogue file in the first place. This could be necessary if you want to properly translate your theme.

  6. Ovidiu says:

    So far so good with the po/mo files but how can I make the content in wordpress site multilanguage ?



Trackbacks/Pingbacks

  1. […] käännöksen korjaamisessa tarvittavat ohjelmat. Sen jälkeen muunnan Transmissionin käyttämän käännöstiedoston tekstieditorin ymmärtämään muotoon seuraavalla komennolla: msgunfmt /usr/share/locale/fi/LC_MESSAGES/transmission-gtk.mo > […]

Obviously Powered by WordPress. © 2003-2013

css.php