| 114 |
putenv("LC_ALL=$lang"); |
putenv("LC_ALL=$lang"); |
| 115 |
putenv("LC_MESSAGE=$lang"); |
putenv("LC_MESSAGE=$lang"); |
| 116 |
putenv("LANG=$lang"); |
putenv("LANG=$lang"); |
| 117 |
$ret = setlocale(LC_ALL, $lang); |
$ret = setlocale(LC_ALL, ''); |
| 118 |
return $ret; |
return $ret; |
| 119 |
} |
} |
| 120 |
|
|
| 124 |
*/ |
*/ |
| 125 |
function debug($message, $untranslated = false){ |
function debug($message, $untranslated = false){ |
| 126 |
$trace = debug_backtrace(); |
$trace = debug_backtrace(); |
| 127 |
$str = sprintf('T_(%s)%s',$message, $untranslated ? '#' : ''); |
$str = sprintf('T_(%s)%s',$message, $untranslated ? ';' : ''); |
| 128 |
if ($this->debug > 1) { |
if ($this->debug > 1) { |
| 129 |
$html = '<span style="border-bottom: thin solid %s" title="%s(%d)">T_(%s)</span>'; |
$html = '<span style="border-bottom: thin solid %s" title="%s(%d)">T_(%s)</span>'; |
| 130 |
$str = sprintf($html, ($untranslated ? 'red' : 'green'), str_replace('\\', '/', $trace[2]['file']), $trace[2]['line'], $message); |
$str = sprintf($html, ($untranslated ? 'red' : 'green'), str_replace('\\', '/', $trace[2]['file']), $trace[2]['line'], $message); |
| 171 |
if ($this->has_gettext){ |
if ($this->has_gettext){ |
| 172 |
bind_textdomain_codeset($domain, $charset); |
bind_textdomain_codeset($domain, $charset); |
| 173 |
} |
} |
| 174 |
return $this->test_domains[$domain]["charset"] = $charset; |
return $this->text_domains[$domain]["charset"] = $charset; |
| 175 |
} |
} |
| 176 |
|
|
| 177 |
/** |
/** |
| 185 |
} else { |
} else { |
| 186 |
$this->load($domain, $path); |
$this->load($domain, $path); |
| 187 |
} |
} |
| 188 |
return $this->test_domains[$domain]["path"] = $path; |
return $this->text_domains[$domain]["path"] = $path; |
| 189 |
} |
} |
| 190 |
|
|
| 191 |
/** |
/** |
| 220 |
*/ |
*/ |
| 221 |
function ngettext($msg1, $msg2, $count){ |
function ngettext($msg1, $msg2, $count){ |
| 222 |
if ($this->has_gettext){ |
if ($this->has_gettext){ |
| 223 |
return ngettext($msg1, $msg2, $count); |
$translation = ngettext($msg1, $msg2, $count); |
| 224 |
} |
} |
| 225 |
if (isset( $this->messages[$this->domain][$msg1])) { |
if (isset( $this->messages[$this->domain][$msg1])) { |
| 226 |
$translation = $this->messages[$this->domain][$msg1]; |
$translation = $this->messages[$this->domain][$msg1]; |
| 360 |
if (is_null($gettext)) { |
if (is_null($gettext)) { |
| 361 |
require_once('phpgettext.class.php'); |
require_once('phpgettext.class.php'); |
| 362 |
$gettext = new PHPGettext(); |
$gettext = new PHPGettext(); |
| 363 |
|
$gettext->has_gettext = true; |
| 364 |
if (!function_exists("gettext") || !function_exists("_")) { |
if (!function_exists("gettext") || !function_exists("_")) { |
| 365 |
$gettext->has_gettext = false; |
$gettext->has_gettext = false; |
| 366 |
require_once('phpgettext.compat.php'); |
require_once('phpgettext.compat.php'); |