I am interested in the “best approach” to making sure your Linux & GTK based application is built from the ground up to support i18n and localization with minimal amount of pain.
I’ve always heard that localization can be a real pain point to implement, so I am wondering if there is a good guideline and/or approach that can help make it as straight forward to have i18n and localization support in an application?
Here’s an example guideline that I read, however this is Microsoft Windows specific… WPF Globalization and Localization Overview
Use gettext. It’s the standard method of supporting I18N on Linux (and can be used on other platforms as well).
The documentation looks intimidating but it basically boils down to changing your code from:
to
then the program xgettext will extract all the strings in
gettext()into PO files which can be edited using tools like poeditHere’s a nice short tutorial on how to use gettext: A tutorial on Native Language Support using GNU gettext. It basically covers the typical workflow of using gettext. Another nice article is PHP centric:Gettext – O’Reilly Media. Google around for “gettext tutorial” and you’ll probably find more.