I read all the questions regarding not working language detection but couldn’t find any solution.
So the browser seems to always use the language set as ‘default’ = > true (in my case English) when I change it to German the website always opens up in German. The strange thing is when I use <?php echo $site->detectedLanguage() ?> it always gives me back the correct language of the system. So why is the language result from detectedLanguage() different from c::set(‘language.detect’, true); ? And how can I make it work to display the language of the OS language which is visiting my site?
I have done that, for example on the iPhone deleted all website data under settings and in the advanced menu and also blocked cookies. But I still only get the English version displayed on that device. Any other idea?
I know thats not really your issue, but my point is different browsers and operating systems report languages differently, and its a tricky thing to detect.
I used to use Chrome. But now I use for testing my Macbook (set to English) and iPhone (set to German) and I delete browser data and cookies every time. I also tried it on Kirby user @mauricehh website: https://maurice-renck.de and there it works pretty fine with my setup (Macbook gets the EN and iPhone the DE site) (invited him to the talk already).
I didn’t set anything special, my lang-setup looks similar to yours, beside that German is my default option. I had some problems with older version of kirby, where I needed to do some magic, but since Kirby 2 that wasn’t necessary anymore.
If you have access to your servers logfile settings, you could try to configure your access log, so that it shows the detected language of the user-agent (if it doesn’t already). Maybe this will help you figuring out the cause of your problem.
Just wanted to let you know with a fresh Kirby install the language detection works fine locally (tested it with the Chrome add-on and when switch to DE the DE site get’s display and switching to EN the EN site is displayed, cookies need to be deleted before testing of course). Currently I don’t know what’s wrong with my setup, same version, same config file …
Guys, I just wanted to let you know that it works now but I don’t actually know why. I have installed the Starterkit on the same server to be sure it’s not any server related config. This worked great. I tried then to replace step by step a few files from the Starterkit to my project, started with the config.php, removed all widgets and plugins and also removed the site/cache. In the end however I have used the originale files from the project and then it worked (without any changes to the project files). Anyway, for everybody having problems with this checking if the Starterkit works was a good idea to start with