Welcome Guest, Not a member yet? Register   Sign In
Special Character
#15

[eluser]dnc[/eluser]
I have written a function that detects the users language based on 2 digit lang code posted from PHP from the browser.


Now you have to name all language files the 2 digit codes including the system folder.

Now most say 'yea right MOFO'
But can detect and redirect back to English is not detected.....
YES Simple, but, effective so .....



hers is how I partially do this as to not make a Wiki out of the situation;

Code:
/*
* Place In your config file overwriting  
$config['language']
* Courtesy would be nice in your source, but not required.
* Courtesy Bill Anderson : use it now or later
@ as POSTED ON : http://ellislab.com/forums/viewthread/218776/
*/

$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if(isset ($lang) && file_exists(APPPATH . 'language/'.$lang )) {
$config['language'] = $lang;
}
else {
    $config['language'] = 'en';    
}

And then name all language folders the 2 letter code returned from PHP including system files which would overridde CI language file system from the start.



Messages In This Thread
Special Character - by El Forum - 06-06-2012, 09:14 PM
Special Character - by El Forum - 06-06-2012, 09:32 PM
Special Character - by El Forum - 06-06-2012, 09:49 PM
Special Character - by El Forum - 06-06-2012, 10:01 PM
Special Character - by El Forum - 06-06-2012, 10:14 PM
Special Character - by El Forum - 06-06-2012, 10:17 PM
Special Character - by El Forum - 06-06-2012, 10:23 PM
Special Character - by El Forum - 06-06-2012, 10:27 PM
Special Character - by El Forum - 06-06-2012, 10:40 PM
Special Character - by El Forum - 06-06-2012, 10:42 PM
Special Character - by El Forum - 06-06-2012, 10:43 PM
Special Character - by El Forum - 06-06-2012, 10:45 PM
Special Character - by El Forum - 06-06-2012, 10:47 PM
Special Character - by El Forum - 06-06-2012, 10:55 PM
Special Character - by El Forum - 06-06-2012, 11:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB