Ian Eure wrote:
PHP's gettext was my next choice - it's the fastest - but it didn't work out
for a few reasons.

- Hard to search for translated strings

Getting strings marked as 'to be translated' with _("...") is easy with "xgettext -k_ -L PHP ...". Then with msgmerge the partially translated files can get recently added strings in src file. The big advantage of gettext is its toolchain (xgettext, msgmerge, po editors etc), and translators only have to translate txt files (no php/perl knowledge required).

- Hard to set up

With gettext php extension installed and correct path, it's not that hard (locale/fr_BE/LC_MESSAGES/domain.mo). Only thing really annoying is that locale names arent standardized : win uses long names like English, French etc while *nix simply uses std names like fr_BE, en_US, nl_NL etc

Well, there is a second one. To set locale, you have to define env var
(LC_MESSAGES, LC_ALL, LANGUAGE,...) Not sure same settings work everywhere
(Unix boxes at least). But with php safe_mode on, only some env vars can
be set, which means editing php.ini is often required to fix this, like
safe_mode_allowed_env_vars = "PHP_,LC,LANG,TZ"

Perhaps a third, but I never got an answer to this one.
I dont know if using gettext with php (as Apache module) is "thread safe".
If 2 scripts are setting locale, I just hope they wont mix.

- Not easy to use with a site that needs to store content in a database and
translate it as well

I think translating content in DB simply involves adding a column for each field to translate. Ex for a title field, adding title_fr, title_de etc

Christophe

--
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to