Welcome Guest, Not a member yet? Register   Sign In
Changing language
#2

[eluser]Akinzekeel[/eluser]
I used to load the language in a pre_controller hook.

In this hook I first check if there is a language set in $this->CI->session->userdata. Depending on this, I either load the default language or the one which has been stored for this session.

If the user wishes to change the language, I call a public change_language controller-method with two arguments: the language and a base64-encoded URL of the page which is currently displayed. The method will then simply save the new language to the session, decode the base64 URL and redirect back to it.

Since the new language is now stored in the session, the hook will load that language as mentioned above.


Messages In This Thread
Changing language - by El Forum - 09-19-2010, 02:29 AM
Changing language - by El Forum - 09-19-2010, 11:16 AM
Changing language - by El Forum - 09-19-2010, 11:25 AM
Changing language - by El Forum - 09-19-2010, 12:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB