No language switching

Hi ,

I cant make my site switch to the french langage ...  fr files are present, event if some new messages are missing in them, the already present messages should be taken in account, shouldn't they ?  

  • I changed the elgg_echo function to :

    function elgg_echo($message_key, $language = "") {
               
                global $CONFIG;
                   
                static $CURRENT_LANGUAGE;
                if (!$CURRENT_LANGUAGE) {
                    $CURRENT_LANGUAGE = get_language();
                    } else {
                    $language = $CURRENT_LANGUAGE;
                    }

                if (isset($CONFIG->translations[$language][$message_key])) {
                    return $CONFIG->translations[$language][$message_key];
                } else if (isset($CONFIG->translations["en"][$message_key])) {
                    return $CONFIG->translations["en"][$message_key];
                }
                   
                return $message_key;
               
            }
     And it works ... even if i cant see what was wrong with the original one ....

  • Oups, i forgot the incoming value of $language :)

     

    so this one should be closed to a good one .... (at least it switch languages correctly on my side !)

     

    function elgg_echo($message_key, $language = "") {
               
                global $CONFIG;
                   
                static $CURRENT_LANGUAGE;
                if (!$language) {
                    if (!$CURRENT_LANGUAGE) {
                        $CURRENT_LANGUAGE = get_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])) {
                    return $CONFIG->translations["en"][$message_key];
                }
                   
                return $message_key;
               
            }

     

  • Hi, this should have been fixed in SVN. Essentially the problem was caused by a cache value being set but not checked for.

  • on my site the same problem. Thanks for this patch.

  • Hi friends,

    What is the name of the file you made change above ?

  • Hello, th fil is here : engine/lib/languages.php

    Christophe

  • Note that this problem has been fixed in 1.5 RC2 (available from the downloads page).

    Much better to install that rather than making this single patch as RC2 fixes a number of issues.

  • Ok, works fine with rc2

    Christophe