Closed Norcoen closed 8 years ago
I think one of the problems seems to be sending http code 301. Browser caches this and does not ask again for another redirect next time. So after switching language you will always be routed back to the first language selected (or maybe autodetect, since setting language is ignored in my case)
Maybe the migrate option should have permanent true/false switch? Also setting migrate = FALSE does not seem to work, it's always activated if it is not commented out
Hi @Norcoen, sorry I've missed your initial message. The plugin is entirely based on URI detection, so manually defined language is ignored.
What would make sense for your migration would be to redirect the root path /
to the appropriate homepage, according to the session variable.
Something like this:
$f3->set('MULTILANG.root',function($f3){
$lang=$f3->get('SESSION.sprache')?:Multilang::instance()->current;
$f3->reroute('/'.$lang);
});
This way, on a first visit, a German would be redirected to /de
. But if he prefered English and selected this language, on a second visit, he would be redirected to /en
.
NB: the root URL responds with a non-permanent redirect (302) while migrated URLs (migrate=TRUE
) respond with a permanent redirect (301).
I'm trying to use F3 in an existing project, writing new modules with F3 and slowly migrating old ones. We have a language switch on the website which sets the language in session, so I read that and pass it to F3 after reading my config.ini
I started using multilang today, so I might be wrong, but it seems like my manually set language is ignored by multilang and it always detects my german browser language.
Do you have any ideas what could have gone wrong in this case?
Kind regards Frank