Thursday, June 26, 2008

A simple TurboGears i18n principle.

I've been doing a lot of internationalization improvements in Enomalism lately and I've noticed a generally good practice to use when building i18n applications.

TurboGears adds a built-in _() Python function that serves as a basic message translator. During run-time, if the label is found in the message catalog for the current locale, the label is replaced. Simple enough.

Things tend to get messy when there are %s string formatters in the label. I find that this severely limits the opportunity for language label re-use.

No comments :

Post a Comment