web analytics
Skip to main content
internationalization-translation-flags-globe

How to compile PO files

Everybody knows gettext. Well, almost everybody… It is an internationalization and localization system popularly used by many applications and systems everywhere.

It is based in source files that hold the original texts of your application (usually written in English), and the corresponding translations for all the languages you need.

The source files have the extension PO (for Portable Object), and must be compiled to MO files (from Machine Object) before being used.

If you are on Linux, you can compile a PO file directly using the msgfmt utility. Just type:

msgfmt -o lang.mo lang.po

Replacing lang by the name of your language file.

And if you want to have more control over the creation and maintenance of your PO and MO files, try some nice editor like poedit.

There you have it! And good luck with your multilanguage site/app!

Bye! Tchüss! Hasta luego! Ciao! Até logo! À bientôt!