Make sq_change_text_domain() return previous text domain
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 29 Jun 2007 23:29:09 +0000 (23:29 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 29 Jun 2007 23:29:09 +0000 (23:29 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12494 7612ce4b-ef26-0410-bec9-ea0150e637f0

include/languages.php

index a20af558e2afa6a96d9fd32bfe294dda7483ede1..a42ded2f31d9247df914e076b2a750c2ec012a26 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;
 }
 
 /**