Move getSig, which can produce error output, after the point where the template syste...
[squirrelmail.git] / include / languages.php
index a20af558e2afa6a96d9fd32bfe294dda7483ede1..7ecea5b13a5f5e83da7dfcb7045e50ce92685b24 100644 (file)
  *                            (OPTIONAL; default is SquirrelMail
  *                            locale directory).
  *
- * @return void
+ * @return string The name of the text domain that was set
+ *                *BEFORE* it is changed herein - NOTE that
+ *                this differs from PHP's textdomain() 
  *
  * @since 1.5.2 and 1.4.10 
  */
 function sq_change_text_domain($domain_name, $directory='') {
 
-    if (empty($directory)) $directory = SM_PATH . 'locale/';
-
     static $domains_already_seen = array();
+    global $gettext_domain;
+    $return_value = $gettext_domain;
 
     // only need to call bindtextdomain() once 
     //
     if (in_array($domain_name, $domains_already_seen)) {
         sq_textdomain($domain_name);
-        return;
+        return $return_value;
     }
 
     $domains_already_seen[] = $domain_name;
 
+    if (empty($directory)) $directory = SM_PATH . 'locale/';
+
     sq_bindtextdomain($domain_name, $directory);
     sq_textdomain($domain_name);
 
+    return $return_value;
 }
 
 /**
@@ -84,7 +89,7 @@ function sq_change_text_domain($domain_name, $directory='') {
 function sq_bindtextdomain($domain,$dir='') {
     global $l10n, $gettext_flags, $sm_notAlias;
 
-    if (empty($dir)) $dir = SM_PATH . 'locale/'
+    if (empty($dir)) $dir = SM_PATH . 'locale/';
 
     if ($gettext_flags==7) {
         // gettext extension without ngettext