hi there,
this is my first post in the forums, and i got to say that up to this point working with process wire was a really easy-going experience. now i'm not quite sure if i'm just over-thinking my whole problem and i hope someone can help me.
i have a setup of processwire running with german as default and english as additional language. i successfully implemented a language-switcher which works like a charm.
now i want processwire to automatically check the visitors browserlanguage (basically on starting the session) and set it as default (if not german -> english)
BUT
keep open the possibility to do a manual switch.
my first very, very simple piece of code (which terribly failed) looked like this (in my header template)
if(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2) != 'de') {
$user->language = $languages->get('en');
}
now i know what the problem is (my header.inc gets included everytime and does this request even after a switch), but cant make my mind up about a proper solution...
i also didnt find something about this very specific problem by using the search, but am really grateful about any advice
best,
overoon