X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fgettext.php;h=af1e118712324b756c85652831a932afa54212f6;hb=209e24bb063cb116e8564e226e0a2687276cb9d5;hp=6fc7884d09f93c761061ae6cec56d4e097f1f4cb;hpb=987843d6fb92c1c27b2b8e19ec07226a28e3764c;p=squirrelmail.git diff --git a/functions/gettext.php b/functions/gettext.php index 6fc7884d..af1e1187 100644 --- a/functions/gettext.php +++ b/functions/gettext.php @@ -1,21 +1,21 @@ error==1) return $str; + if (! isset($l10n[$gettext_domain]) || + ! is_object($l10n[$gettext_domain]) || + $l10n[$gettext_domain]->error==1) + return $str; return $l10n[$gettext_domain]->translate($str); } @@ -74,4 +77,27 @@ function textdomain($name = false) { if ($name) $gettext_domain=$name; return $gettext_domain; } -?> \ No newline at end of file + +/** + * Safety check. + * Setup where three standard gettext functions don't exist and dgettext() exists. + */ +if (! function_exists('dgettext')) { + /** + * Alternative php dgettext function + * + * @link http://www.php.net/function.dgettext + * @param string $domain Gettext domain + * @param string $str English string + * @return string translated string + * @since 1.5.1 + */ + function dgettext($domain, $str) { + global $l10n; + if (! isset($l10n[$domain]) || + ! is_object($l10n[$domain]) || + $l10n[$domain]->error==1) + return $str; + return $l10n[$domain]->translate($str); + } +}