Gettext?




I’m planning to stop doing i18n like I have been, and instead use gettext, the GNU toolkit for localization. However, I don’t think that it will be very easy. To start planning, I found these articles:

http://www.onlamp.com/pub/a/php/2002/06/13/php.html
http://www.ibm.com/developerworks/library/os-php-intl/
http://www.appliedlanguage.com/articles/internationalization_using_php_and_get_text.shtml

They talk about the use of gettext and php, but perhaps I should be looking for information about gettext and XML / XSL?

Aha, I think I figured it out, and I think we’re in good shape. Since the XSL templates always reference XML nodes in the flow document for string values, I’ll just have to figure out a different way of getting those values into the flow document. Most likely it will be done using a php script to set the locale and language, reference the gettext documents, and then add the translated strings to the flow document.

I had a hard time testing this out because if an initial problem with my test case, but thanks to this comment at php.net about locales under /usr/lib/locale and linux, I was able to figure it out.

Still a little more work to do, and I’ll have to figure out which open source accounting program to share languages with, probably gnucash. I just examined their .po files, and they are actually way more specific to GnuCash than I thought. I then examined SMB Ledger’s po files and they look nice, and SQL Ledger doesn’t use gettext, so it looks like SMB Ledger is the way to go.

In thinking about this further, I feel like building XML files from .po files is the right way to go, but that seems a little bit excessive.

Good news! There is hope. I found this page helpful:

http://wiki.openbravo.com/wiki/index.php/Translating_Openbravo

Specifically since it referred me to a tool called xml2po, which does what I need!

http://svn.gnome.org/viewvc/gnome-doc-utils/trunk/xml2po/

WOW! This is exactly what PBooks needs. This pleases me immensely.

0 Responses to “Gettext?”


  1. No Comments

Leave a Reply