Working with gettext

  1. Creating the translation directory structure
  2. Portable Object files
  3. Translation Domain
  4. Using Translator in PHP
  5. Variable interpolation

gettext is a standard GNU internationalization / translation system which can be used with PHP and which is supported by PHPTAL.

The usage of gettext is simple but you will have to perform some tests to be sure everything works fine on your system.

First, PHP must be compiled with the --with-gettext flag. See PHP documentation for how to do this.

You can test your installation using following peace of code:


//
// test if gettext extension is installed with php
//

if (!function_exists("gettext"))
{
    echo "gettext is not installed\n";
}
else
{
    echo "gettext is supported\n";
}