суббота, 6 августа 2005 г.

Localizing PHP web sites using gettext

Localizing PHP web sites using gettext

    Developing multi language web sites using PHP is actually very easy. A common approach is having an include file for every supported language which contains an array that maps string ids to localized text (for example "WelcomeText" => "Welcome to our homepage." would be included using something like <?= $strings["WelcomeText"] >). However there are several problems with this approach. First of all, when the application is updated and additional strings are added, there is no way to determine which new strings were added and if they are present in every language (unless you write a script for it). What happens if a newly added string is not yet translated into a specific language?