Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB Language switching (Trac #838) #838

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 3 comments
Closed

PB Language switching (Trac #838) #838

elgg-gitbot opened this issue Feb 16, 2013 · 3 comments

Comments

@elgg-gitbot
Copy link

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

Original ticket http://trac.elgg.org/ticket/838 on 39179932-02-02 by trac user fabcol, assigned to unknown.

Elgg version: 1.5

Once upgraded to 1.5, the system do not swith any more to the correct language (always stay in english language)

I correct that pb by changing the elgg_echo function to :

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;

    }
@elgg-gitbot
Copy link
Author

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

trac user marcus wrote on 39179983-07-20

(In [svn:3108]) Closes #838: Missing set from static var.

@elgg-gitbot
Copy link
Author

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

trac user gabrielinux wrote on 39340760-04-29

This does not appear to be fixed. I tried the latest revision (uploaded by Marcus), and user languages still do not work. Apparently, $user->language is empty even when a user sets their preferred language.

@elgg-gitbot
Copy link
Author

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

trac user marcus wrote on 39341585-03-08

This works for me, please note that the system language test is performed before the session is loaded as part of the language library initialisation, so get_language will be called once before $user is available.

This does not however prevent language detection from working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.