PHP Localization Question

I recommend you take a look at Zend_translate, Zend_locale and Zend_Date. I’m only starting to dabble with them myself, but to me, they already look like a really good, clean and modern solution to internationalization, in contrast to the chaos that is gettext.

The introduction to Zend_translate lists a number of strong arguments why to choose it (or something similar) over gettext.

In multilingual applications, the
content must be translated into
several languages and display content
depending on the user’s language. PHP
offers already several ways to handle
such problems, however the PHP
solution has some problems:

Inconsistent API: There is no single API for the different source
formats. The usage of gettext for
example is very complicated.

PHP supports only gettext and native array: PHP itself offers only
support for array or gettext. All
other source formats have to be coded
manually, because there is no native
support.

No detection of the default language: The default language of the
user cannot be detected without deeper
knowledge of the backgrounds for the
different web browsers.

Gettext is not thread-safe: PHP’s gettext library is not thread
safe, and it should not be used in a
multithreaded environment. This is due
to problems with gettext itself, not
PHP, but it is an existing problem.

Leave a Comment