Blueprint changed by rejon: Whiteboard changed: I noticed as well, this code is already available in the upgrader app. It looks like this: - /** - * - * Try to get language to translate - * Check $_GET and $_SESSION (in this order) to set language. - * - * @param $getVar $_GET key or variable to exam - * @param $sessionVar $_SESSION key or variable to exam and store the value. - */ + /** + * + * Try to get language to translate + * Check $_GET and $_SESSION (in this order) to set language. + * + * @param $getVar $_GET key or variable to exam + * @param $sessionVar $_SESSION key or variable to exam and store the value. + */ - function checkLanguage( $getVar ="_language", + function checkLanguage( $getVar ="_language", $sessionVar="language"){ - // set language by Get,session or "en" - if ( $getVar && isset($_GET[$getVar]) ){ - $found= $_GET[$getVar]; - } elseif ( $sessionVar && isset($_SESSION[$sessionVar]) ){ - $found= $_SESSION[$sessionVar]; - } else { - $found= false; - } + // set language by Get,session or "en" + if ( $getVar && isset($_GET[$getVar]) ){ + $found= $_GET[$getVar]; + } elseif ( $sessionVar && isset($_SESSION[$sessionVar]) ){ + $found= $_SESSION[$sessionVar]; + } else { + $found= false; + } - // check language. Only ISO is allowed: en, es, or en_GB. - if ( $found && preg_match('/^[a-z]{2}(\_[A-Z]{2})?$/', $found) ){ - $this->translateTo= $found; - if ( $sessionVar ){ - $_SESSION[$sessionVar]= $found; - } - } - } + // check language. Only ISO is allowed: en, es, or en_GB. + if ( $found && preg_match('/^[a-z]{2}(\_[A-Z]{2})?$/', $found) ){ + $this->translateTo= $found; + if ( $sessionVar ){ + $_SESSION[$sessionVar]= $found; + } + } + } + + + ### + + There are also some other ways to try and determine the language of a + user's system and browser, and redirect a user to the appropriate + language. See the cchost code above. @rejon
-- Add Language Negotation to Code https://blueprints.launchpad.net/aikiframework/+spec/add-language-negotiation _______________________________________________ Mailing list: https://launchpad.net/~aikiframework-devel Post to : aikiframework-devel@lists.launchpad.net Unsubscribe : https://launchpad.net/~aikiframework-devel More help : https://help.launchpad.net/ListHelp