[geeklog-devel] Question about internationalization and look-ups
mjervis at gmail.com
Sat Feb 9 02:55:50 EST 2008
> I should probably just take a look at one of the other CMS's engines out there. Somebody has probably already fixed this.
Drupal uses a method t(str) that translates everything, so what they do is do:
t('-- Select Type --'));
And the function that loads your values from the lookup table would
call t() on each value it gets back. t() then uses unix gettext po
file interfaces to translate. There's a UI in Drupal that allows you
to find every value that's been passed into t() so far in your install
and put a translation into the database for every language. So the key
difference is that the translations are in the database (if I remember
Wordpress does something similar, but uses gettext properly, using .po
files dropped into your install:
Drupal have the advantage that if you add translatable strings it's
easy to add them to the translation (i.e. change lookup values for a
pick list in a database table), Wordpress have the advantage that it's
a hell of a lot easier to create and install a language for
distribution. AS Dirk said:
"I don't think there are any truly elegant solutions - only less awkward
And not even many of them.
Zend Framework has a translation class:
Appears to be lead by a contributor, not a Zend employee, and I'm not
sure it's very good. It works and everything, but it's not fast and
it's bloating fast.
I spent some time looking at it last summer for use in another
project, I concluded that modular langauge files using php arrays is
probably the best way of doing it I've come across so far (looking at
Drupal, Wordpress, PHPBB3 and Geeklog and my own simple tests of
In the class I implemented for the small project I was working on I
set it up so that if it didn't translate you got the English. Sucks a
little because "dynamic" values from db lookups will be part
translated if you can't keep your translations up to date. But I've
yet to solve it in a better way.
Been doing something similar in MS techs in the day job, can't find a
better way there either.
More information about the geeklog-devel