From: gustavf Date: Wed, 15 Mar 2000 09:45:52 +0000 (+0000) Subject: Things should now work even if PHP is compiled without gettext support. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=03ff39b20a43a1fe07e71cd812988c76a290a3da;hp=3379d740647674a0b0b71ec69e95136d0c411303 Things should now work even if PHP is compiled without gettext support. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@301 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/page_header.php b/functions/page_header.php index 783ed6c2..030a6070 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -15,18 +15,25 @@ // receiving input from HTTP forms header ("Content-Type: text/html; charset=iso-8859-1"); - // Setting the language to use for gettext if it is not English - // (the default language) or empty. - $squirrelmail_language = getPref ($data_dir, $username, "language"); - if ($squirrelmail_language != "en" && $squirrelmail_language != "") { - putenv("LANG=$squirrelmail_language"); - bindtextdomain("squirrelmail", "../locale/"); - textdomain("squirrelmail"); - - // Setting cookie to use on the login screen the next time the - // same user logs in. - setcookie("squirrelmail_language", $squirrelmail_language, - time()+2592000); + // Check to see if gettext is installed + if (function_exists("_")) { + // Setting the language to use for gettext if it is not English + // (the default language) or empty. + $squirrelmail_language = getPref ($data_dir, $username, "language"); + if ($squirrelmail_language != "en" && $squirrelmail_language != "") { + putenv("LANG=$squirrelmail_language"); + bindtextdomain("squirrelmail", "../locale/"); + textdomain("squirrelmail"); + + // Setting cookie to use on the login screen the next time the + // same user logs in. + setcookie("squirrelmail_language", $squirrelmail_language, + time()+2592000); + } + } else { + function _($string) { + return $string; + } } function displayPageHeader($color, $mailbox) { diff --git a/src/login.php b/src/login.php index 64eb4c90..9a00a2d8 100644 --- a/src/login.php +++ b/src/login.php @@ -15,13 +15,20 @@ if (!isset($strings_php)) include("../functions/strings.php"); - // $squirrelmail_language is set by a cookie when the user selects - // language - if (isset($squirrelmail_language)) { - if ($squirrelmail_language != "en") { - putenv("LANG=".$squirrelmail_language); - bindtextdomain("squirrelmail", "../locale/"); - textdomain("squirrelmail"); + // let's check to see if they compiled with gettext support + if (!function_exists("_")) { + function _($string) { + return $string; + } + } else { + // $squirrelmail_language is set by a cookie when the user selects + // language + if (isset($squirrelmail_language)) { + if ($squirrelmail_language != "en") { + putenv("LANG=".$squirrelmail_language); + bindtextdomain("squirrelmail", "../locale/"); + textdomain("squirrelmail"); + } } } @@ -31,12 +38,6 @@ echo "\n"; echo "\n"; - // let's check to see if they compiled with gettext support - if (!function_exists("_")) { - echo "
PHP was not configured --with-gettext. Reconfigure and try again.
"; - exit; - } - echo "
\n"; echo "
\n"; echo "
";