|
@@ -12,6 +12,8 @@
|
|
* Possible use in other PHP scripts? The only SM-specific thing is
|
|
* Possible use in other PHP scripts? The only SM-specific thing is
|
|
* $sm_language, I think
|
|
* $sm_language, I think
|
|
*
|
|
*
|
|
|
|
+ * @link http://www.php.net/gettext Original php gettext manual
|
|
|
|
+ *
|
|
* $Id$
|
|
* $Id$
|
|
* @package squirrelmail
|
|
* @package squirrelmail
|
|
*/
|
|
*/
|
|
@@ -48,6 +50,13 @@ if (! isset($gettext_php_short_circuit)) {
|
|
sqsession_register($gettext_php_short_circuit, 'gettext_php_short_circuit');
|
|
sqsession_register($gettext_php_short_circuit, 'gettext_php_short_circuit');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Converts .po file into array and stores it in session.
|
|
|
|
+ *
|
|
|
|
+ * Used internally by _($str) function
|
|
|
|
+ *
|
|
|
|
+ * @internal function is used internally by functions/gettext.php code
|
|
|
|
+ */
|
|
function gettext_php_load_strings() {
|
|
function gettext_php_load_strings() {
|
|
global $squirrelmail_language, $gettext_php_translateStrings,
|
|
global $squirrelmail_language, $gettext_php_translateStrings,
|
|
$gettext_php_domain, $gettext_php_dir, $gettext_php_loaded,
|
|
$gettext_php_domain, $gettext_php_dir, $gettext_php_loaded,
|
|
@@ -142,6 +151,14 @@ function gettext_php_load_strings() {
|
|
$gettext_php_loaded_language = $squirrelmail_language;
|
|
$gettext_php_loaded_language = $squirrelmail_language;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Alternative php gettext function (short form)
|
|
|
|
+ *
|
|
|
|
+ * @link http://www.php.net/function.gettext
|
|
|
|
+ *
|
|
|
|
+ * @param string $str English string
|
|
|
|
+ * @return string translated string
|
|
|
|
+ */
|
|
function _($str) {
|
|
function _($str) {
|
|
global $gettext_php_loaded, $gettext_php_translateStrings,
|
|
global $gettext_php_loaded, $gettext_php_translateStrings,
|
|
$squirrelmail_language, $gettext_php_loaded_language,
|
|
$squirrelmail_language, $gettext_php_loaded_language,
|
|
@@ -188,6 +205,16 @@ function _($str) {
|
|
return $str;
|
|
return $str;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Alternative php bindtextdomain function
|
|
|
|
+ *
|
|
|
|
+ * Sets path to directory containing domain translations
|
|
|
|
+ *
|
|
|
|
+ * @link http://www.php.net/function.bindtextdomain
|
|
|
|
+ * @param string $name gettext domain name
|
|
|
|
+ * @param string $dir directory that contains all translations
|
|
|
|
+ * @return string path to translation directory
|
|
|
|
+ */
|
|
function bindtextdomain($name, $dir) {
|
|
function bindtextdomain($name, $dir) {
|
|
global $gettext_php_domain, $gettext_php_dir, $gettext_php_loaded;
|
|
global $gettext_php_domain, $gettext_php_dir, $gettext_php_loaded;
|
|
|
|
|
|
@@ -203,6 +230,15 @@ function bindtextdomain($name, $dir) {
|
|
return $dir;
|
|
return $dir;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Alternative php textdomain function
|
|
|
|
+ *
|
|
|
|
+ * Sets default domain name
|
|
|
|
+ *
|
|
|
|
+ * @link http://www.php.net/function.textdomain
|
|
|
|
+ * @param string $name gettext domain name
|
|
|
|
+ * @return string gettext domain name
|
|
|
|
+ */
|
|
function textdomain($name = false) {
|
|
function textdomain($name = false) {
|
|
global $gettext_php_domain, $gettext_php_loaded;
|
|
global $gettext_php_domain, $gettext_php_loaded;
|
|
|
|
|
|
@@ -210,7 +246,7 @@ function textdomain($name = false) {
|
|
$gettext_php_domain = $name;
|
|
$gettext_php_domain = $name;
|
|
$gettext_php_loaded = false;
|
|
$gettext_php_loaded = false;
|
|
}
|
|
}
|
|
|
|
+
|
|
return $gettext_php_domain;
|
|
return $gettext_php_domain;
|
|
}
|
|
}
|
|
-
|
|
|
|
-?>
|
|
|
|
|
|
+?>
|