WP Translations: mo and po files
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.














Comments RSS
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.
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.
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.
[...] [Entrada traducida. Original] [...]
So far so good with the po/mo files but how can I make the content in wordpress site multilanguage ?
[...] Weblog Tools Collection - WordPress Translations: mo and po files [...]
[...] 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 > [...]