Language switch with sessions |
[eluser]siptik[/eluser]
[quote author="Ewout" date="1352109043"]Maybe the first click doesn't seem to effect the page because the language load happens before the initialization in the index function.[/quote] It's work fine on my computer!!! I tested his project and my colleague tested it, but it works fine for us!
[eluser]chris1986m[/eluser]
Yeah siptik, its soo strange!! I test it again on two other systems and it doesn't work... @Ewout: I think so too. But how can I fix the problem with this timing? Saving session in database is not possible at the moment.
[eluser]Ewout[/eluser]
What if you haven't selected a language at the start? Is it german then?
[eluser]chris1986m[/eluser]
Yes on start its german. Look at the code on the top. defaultLanguage = german "de" Code: if (!$this->session->userdata('language')) Updating is good idea. I'll test it.
[eluser]LuckyFella73[/eluser]
Hi Chris, I would recommend you to use Maestrics library. It does what you started to solve yourself providing everything you need so far. Only difference I can see is that in his library the language identifier is set in the first url segment. http://maestric.com/doc/php/codeigniter_i18n
[eluser]chris1986m[/eluser]
Cool! I'll test it this week and i hope its the reason for my problem.
[eluser]chris1986m[/eluser]
Hi at all, sorry for my late response. Now i have solved my problem. Here is the controller which works very nice. Code: class Start extends CI_Controller { Thanks for all your help.
[eluser]chris1986m[/eluser]
Hi at all, this week i get a message, that the language switch problem is always there... I become crazy... So this morning i checked all my code again and split it. Please, is there someone who can help? Code: $autoload['libraries'] = array('session', 'user_agent'); start.php controller Code: class Start extends CI_Controller { language.php controller Code: class Language extends CI_Controller { href="/language/set/en" href="/language/set/de" Please let me know if you have some ideas. Thanks!
[eluser]chris1986m[/eluser]
Hey, i think the problem are the sessions. After the reload the session variable will be overwritten? The controller language works fine. But something is shit in the start controller. When i remove the redirect code and will manual reload the page after language switch. Everything works fine! PHP is not my favorite... As an Frontend-Developer, i work with Javascript... :down: Greets |
Welcome Guest, Not a member yet? Register Sign In |