Skip to content

How to convert .po to .mo using php | php .po to .mo conversion script

WordPress version of CMSwithTMS supports theme translation. One of the challenges we faced was converting the translated .po file that GlobalSight outputs to an .mo file that WordPress can read.

How to convert po to mo using php?

The most common way of converting a po file to an mo file is using the msgfmt function. However this requires the gettext library and is not super easy to run remotely. Good news is, Joss Crowcroft created a php script which can handle this conversion.

The script is available on github. The conversion is as easy as:

<?php require(‘php-mo.php’); phpmo_convert(‘mypofile.po’, ‘’ );?>

The script worked without any errors during my initial testing.

Categories: Internationalization.

Comment Feed

One Response

  1. If you’re interested in an simple way to convert po files to mo files, try this online converter

Some HTML is OK

or, reply to this post via trackback.