3/6/2007 ↓

WP Translations: mo and po files

Author: Mark Ghosh Category: General, HOW-TO, WordPress

Thanks for visiting! If you're new here, you may want to subscribe to our RSS feed. This blog posts regular Wordpress news, updates of themes, plugins, ideas, hacks, quick fixes and everything about blogging, especially about Wordpress. Go ahead, subscribe to our feed! You can also receive updates from this blog via email.

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.

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5 out of 5)
Loading ... Loading ...
Sphere: Related Content | stumbleit |

Translate

Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

Latest Videos

Latest WordPress Jobs

9 Comments | Leave a comment | Comments RSS

  1. 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.

    Lloyd Budd (15 comments.) — 03/6/2007 @ 3:03 pm
  2. Lloyd: There was some GPL related questions brought to me regarding .mo files, thus this post and the suggested solution.
    Mark (210 comments.) — 03/6/2007 @ 3:35 pm
  3. 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.

    Lloyd Budd (15 comments.) — 03/7/2007 @ 12:03 am
  4. 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.
    Mark (210 comments.) — 03/7/2007 @ 12:24 am
  5. 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.

    Hans (1 comments.) — 03/7/2007 @ 12:45 pm
  6. [...] [Entrada traducida. Original] [...]

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

    Ovidiu — 03/8/2007 @ 8:53 am
  8. [...] Weblog Tools Collection - WordPress Translations: mo and po files [...]

  9. [...] 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 > [...]

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required, will not be published)


S2