]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
fixes 1315 - language static now being set correctly
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 24 Nov 2009 01:29:46 +0000 (01:29 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 24 Nov 2009 01:29:46 +0000 (01:29 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3703 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/languages.php

index 898fc725fe4b2109bfdc27822c158f350ffb860b..35f406de8650cc1b1185b8ec8a2fae77eaacb720 100644 (file)
@@ -43,6 +43,7 @@ function add_translation($country_code, $language_array) {
 /**
  * Detect the current language being used by the current site or logged in user.
  *
+ * @return string The language code for the site/user or "en" if not set
  */
 function get_current_language() {
        global $CONFIG;
@@ -59,9 +60,7 @@ function get_current_language() {
 /**
  * Gets the current language in use by the system or user.
  *
- * [Marcus Povey 20090216: Not sure why this func is necessary.]
- *
- * @return string The language code (eg "en")
+ * @return string The language code (eg "en") or false if not set
  */
 function get_language() {
        global $CONFIG;
@@ -88,19 +87,20 @@ function get_language() {
  * Given a message shortcode, returns an appropriately translated full-text string
  *
  * @param string $message_key The short message code
- * @param string $language Optionally, the standard language code (defaults to the site default, then English)
- * @return string Either the translated string, or the original English string, or an empty string
+ * @param string $language Optionally, the standard language code (defaults to site/user default, then English)
+ * @return string Either the translated string or the original English string
  */
 function elgg_echo($message_key, $language = "") {
        global $CONFIG;
 
        static $CURRENT_LANGUAGE;
-       if ((!$CURRENT_LANGUAGE) && (!$language)) {
-               $CURRENT_LANGUAGE = $language = get_language();
-       } else {
+       if (!$CURRENT_LANGUAGE) {
+               $CURRENT_LANGUAGE = get_language();
+       }
+       if (!$language) {
                $language = $CURRENT_LANGUAGE;
        }
-
+       
        if (isset($CONFIG->translations[$language][$message_key])) {
                return $CONFIG->translations[$language][$message_key];
        } else if (isset($CONFIG->translations["en"][$message_key])) {