Page 1 of 4
Language detection?
Posted: Fri Jul 11, 2008 4:25 pm
by christiaans
Hey guys (especially Alby),
I was wondering; is there any way I can redirect the CMSms homepage to the detected browser language?
I tried doing this so, by using the HTTP_ACCEPT.. var (created a UDT with it, and used that UDT in the main page of the English part (Which is the default lang)). That works fine and all, but:
for example, when someone with a DUTCH browser language, wants to visit the ENGLISH home page, he/she is automatically redirected to the DUTCH part of the page. Is there any way I can work around that?
So to clearify: I want people that are new to the page, to be redirected to their mother tongue (according to their browser language), but afterwards be able to view the homepage in English as well.
Anyone?
Re: Language detection?
Posted: Fri Jul 11, 2008 7:46 pm
by alby
christiaans wrote:
So to clearify: I want people that are new to the page, to be redirected to their mother tongue (according to their browser language), but afterwards be able to view the homepage in English as well.
Is already done.
Initial check is VS browser languages in same order of config_lang.php (put your primary language site on top of that array)
Alby
Re: Language detection?
Posted: Sat Jul 12, 2008 10:24 am
by christiaans
Okay, so if I understand correctly, it already does that check for me, it will automatically redirect people to their respective languages? If so, awesome.
Re: Language detection?
Posted: Sat Jul 12, 2008 11:00 am
by christiaans
I just tried it again, and IE does redirect me correctly, but Firefox just sends me to the standaard English frontpage, although my browserlanguage is definitely set to another language.
Is this a common firefox problem??
Re: Language detection?
Posted: Sat Jul 12, 2008 11:40 am
by alby
christiaans wrote:
I just tried it again, and IE does redirect me correctly, but Firefox just sends me to the standaard English frontpage, although my browserlanguage is definitely set to another language.
Is this a common firefox problem??
No, depend from your browser language order (Tools > Options > Advanced > Languages) and your language order in config.php
Alby
Re: Language detection?
Posted: Sat Jul 12, 2008 2:08 pm
by christiaans
Hmm, I'll look into it some more. Haven't got it work the way I want to yet.
Re: Language detection?
Posted: Sat Jul 12, 2008 2:09 pm
by alby
christiaans wrote:
Hmm, I'll look into it some more. Haven't got it work the way I want to yet.
What are (in same order) your browser languages and in your config.php?
Alby
Re: Language detection?
Posted: Sat Jul 12, 2008 3:07 pm
by christiaans
Browser lang: Dutch - nl_NL
Config_lang.php: en, it, fr, nl, es, pl, de
Where default lang is en, and force default is turned off.
Hasn't worked for me so far (Firefox3), IE7 works like a charm
Re: Language detection?
Posted: Sat Jul 12, 2008 10:40 pm
by alby
christiaans wrote:
Browser lang: Dutch - nl_NL
Config_lang.php: en, it, fr, nl, es, pl, de
Where default lang is en, and force default is turned off.
Hasn't worked for me so far (Firefox3), IE7 works like a charm
I suppose that your browser have en also
Try to move nl array in config.php before en
Alby
Re: Language detection?
Posted: Fri Dec 12, 2008 2:31 am
by bongobongo
Hi.
Have just installed the cmsmadesimple.
I have two languages installed: en_US and no_NO
Default lang is en_US
"Force initial DEFAULT_LANG" is unchecked in SiteAdmin->GlobalSettings
Can someone please explain to me how to make the site present correct language to client based on
the client's language settings.
Example: Firefox languages in order of preference are:
en-us
en-gb
en
no
Okay I close my firefox and enter:
http://localhost/cmsmadesimple/
Then it displays the Norwegian page.
Why does it not obey the language settings in Firefox which should then give priority to English?
Any suggestions
Re: Language detection?
Posted: Fri Dec 12, 2008 11:57 am
by alby
bongobongo wrote:
Why does it not obey the language settings in Firefox which should then give priority to English?
MLE remember (for 1 day) last language used (with a cookie).
Change browser or clean your cookie for this site or wait tomorrow ....
Alby
Re: Language detection?
Posted: Fri Dec 12, 2008 12:33 pm
by bongobongo
Thanks for that quick reply.
Looks like that fixed it.
Re: Language detection?
Posted: Fri Dec 12, 2008 12:53 pm
by bongobongo
Hmmm
Something weird is still going on:
In IE7 I do this:
If I only have Norwegian [no] in language preference and I delete browsing history (everything) then it
fetches the Norwegian pages from the site.
Now if I add [en-US] to the language preference, but after [no], it fetches the English pages from the site.
Why is that? Should it not obey that [no] is listed first?
If I then remove the [en-US] from the language preference and delete all browsing history then it fetches
my Norwegian pages again.....
This is confusing, any idea why I cannot have both [no] and [en-US] as described above and still
make it fetch my Norwegian pages?
Re: Language detection?
Posted: Fri Dec 12, 2008 1:01 pm
by alby
bongobongo wrote:
If I only have Norwegian [no] in language preference and I delete browsing history (everything) then it
fetches the Norwegian pages from the site.
cookies not histories......
Alby
Re: Language detection?
Posted: Fri Dec 12, 2008 1:13 pm
by bongobongo
I'm actually hitting (in IE7), the "Delete all"l button which
then deletes:
Temporary Internet Files
Cookies
History
Form data
Passwords
Should not be much left to delete
Please re-read my previous post?