]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make init of lang environment happen earlier, or when user language may have changed
authorEvan Prodromou <evan@prodromou.name>
Wed, 6 Aug 2008 03:45:15 +0000 (23:45 -0400)
committerEvan Prodromou <evan@prodromou.name>
Wed, 6 Aug 2008 03:45:15 +0000 (23:45 -0400)
darcs-hash:20080806034515-84dde-e32cbfec2890f50b610d0441659180038b060473.gz

actions/profilesettings.php
actions/register.php
index.php
lib/util.php

index f2fe89826eae19749c83e8287778a892ea4a7f04..bc4fce50b98c2fca8323e0d015c416a0750d08e9 100644 (file)
@@ -140,6 +140,9 @@ class ProfilesettingsAction extends SettingsAction {
                                common_log_db_error($user, 'UPDATE', __FILE__);
                                common_server_error(_('Couldn\'t update user.'));
                                return;
+                       } else {
+                               # Re-initialize language environment if it changed
+                               common_init_language();
                        }
                }
 
index d97e3a18af2c2807286251a2f18100877441b0ec..c539108420095f81da74412f26df49c2fccaf628 100644 (file)
@@ -98,6 +98,8 @@ class RegisterAction extends Action {
                                common_debug('Adding rememberme cookie for ' . $nickname);
                                common_rememberme($user);
                        }
+                       # Re-init language env in case it changed (not yet, but soon)
+                       common_init_language();
                        $this->show_success();
                } else {
                        $this->show_form(_('Invalid username or password.'));
index fad6266466a6a49f586f60f63e1bb81fa674a8b7..de39dd020c37aace898489c3194c49facac5c862 100644 (file)
--- a/index.php
+++ b/index.php
@@ -22,6 +22,14 @@ define('LACONICA', true);
 
 require_once(INSTALLDIR . "/lib/common.php");
 
+# get and cache current user
+
+$user = common_current_user();
+
+# initialize language env
+
+common_init_language();
+
 $action = $_REQUEST['action'];
 
 if (!$action || !preg_match('/^[a-zA-Z0-9_-]*$/', $action)) {
index a904e34e06000875b502cfa6c7d27be41293846b..5e6d9fc6fa53445d9f2c2ebea9c931e516acf3d5 100644 (file)
@@ -131,11 +131,7 @@ function common_end_xml() {
        $xw->flush();
 }
 
-define('PAGE_TYPE_PREFS', 'text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2');
-
-function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=NULL) {
-       global $config, $xw;
-
+function common_init_language() {
        $language = common_language();
        # So we don't have to make people install the gettext locales
        putenv('LANGUAGE='.$language);
@@ -148,7 +144,13 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
        bindtextdomain("laconica", $config['site']['locale_path']);
        bind_textdomain_codeset("laconica", "UTF-8");
        textdomain("laconica");
-       
+}
+
+define('PAGE_TYPE_PREFS', 'text/html,application/xhtml+xml,application/xml;q=0.3,text/xml;q=0.2');
+
+function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=NULL) {
+       global $config, $xw;
+
        $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
 
        # XXX: allow content negotiation for RDF, RSS, or XRDS