Error handling


Errors may occur while :

These errors are represented by a Gettext_Error object thrown by GetText methods.

Full error handling sample :

require_once "GetText.php";

GetText::init();
      
// 
// The language is not recognized by the system ?
//
$err = GetText::setLanguage("un_KN")
if (PEAR::isError($err))
{
    echo $err->toString(), "\n";
}

// 
// The domain does not exists for this language ?
//
$err = GetText::setDomain("mydomain");
if (PEAR::isError($err))
{
    echo $ex->toString(), "\n";
}

//
// Some interpolation variable is missing ?
//
$str = GetText::gettext("my message to translate");
if (PEAR::isError($str))
{
    echo $str->toString(), "\n";
}