setLocale() doesn't change the language set by browser |
Hello everybody
I'm new to CI and to any framework and it's just awesome! I'm not used to write in forums as I'm usualy allways able to find a solution already posted somewhere so it's my first time in 20 years of IT. So I hope my english is ok as the rules say "proper english only" and I correctly explain my problem. So to my problem: I'm making a bilingual site french/german with CMS features so I use bilingual db's and the CI locale feature. The language recognition of browsers works fine but I'm unable to change the language through $this->request->setLocale($language); or setlocale(LC_ALL, $language); when I control it with getLocale() I can see that setLocale() works but there is no change in the views... in Config/App.php public $defaultLocale = 'de'; public $negotiateLocale = true; public $supportedLocales = ['de-CH','de-DE','de-AT','fr-CH','fr-FR','fr-CA','fr-BE','fr','de']; ( tryed also ['de','fr'] ) my switchlanguage-button calls Language.php Controller with: PHP Code: <?php namespace App\Controllers; I'm using session('language') to select the right columns in the db's and the locale for all the titles, bottons, validation errors and more... in BaseController.php I got: PHP Code: $session = \Config\Services::session(); Can you see where I'm wrong? I can't find a solution. CI locale strictly follows the Browsers properties and I can't change it... I'm sure it's something stupid thank you |
Welcome Guest, Not a member yet? Register Sign In |