« Archives in July, 2009

Gotchas with gettext in PHP

Be careful when you first try gettext in PHP, it can be very unreliable/unpredictable because of different naming conventions.

MyApp.po vs MyApp.mo

PO is the human-readable and you perform the translation in here. MO is the binary file and it’s cached by Apache. Thus, you need to restart Apache (XAMPP) after each change to MyApp.po, then recompile it via “msgfmt MyApp.po -o MyApp.mo”. If you forgot to recompile, it won’t have any of the new modifications.

Folder Structure