[thelist] best scheme for translating UI strings?

Sarah Adams sarahwbs at gmail.com
Thu Jul 2 13:59:54 CDT 2009

I'm working on a site that will be multi-lingual - English, French, and
German. I'm trying to decide the best way, in PHP, to handle the
translation of strings in the UI (e.g. login button, instructions,
copyright message, etc).

Previously, when the site was in ColdFusion, I had a custom tag that I
would call, passing it the 3 translations of each string, and returning
the appropriate one. I'm considering doing something similar this time.
The only problem I found with this is it hurt readability a bit having
each string appear 3 times in the source code.

Other options are: using variables to hold each string (I'm not fond of
this one); and doing something like in Drupal, where I simply pass the
English translation of a string to a t() function and it searches the
database for the string and returns the appropriate translation. I think
this would be more work, though, cause I'd have to build an interface to
manage the translation of strings.


sarah adams
web developer & programmer

More information about the thelist mailing list