Language detection?

This is a FORK of the CMS Made Simple project and is not oficially supported in any way by the CMS Made Simple development team.
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Language detection?

Post 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?
alby

Re: Language detection?

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Language detection?

Post 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.
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Language detection?

Post 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??
alby

Re: Language detection?

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Language detection?

Post by christiaans »

Hmm, I'll look into it some more. Haven't got it work the way I want to yet.
alby

Re: Language detection?

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Language detection?

Post 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
alby

Re: Language detection?

Post 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
bongobongo
Forum Members
Forum Members
Posts: 33
Joined: Thu Dec 11, 2008 11:41 pm

Re: Language detection?

Post 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
alby

Re: Language detection?

Post 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
bongobongo
Forum Members
Forum Members
Posts: 33
Joined: Thu Dec 11, 2008 11:41 pm

Re: Language detection?

Post by bongobongo »

Thanks for that quick reply.

Looks like that fixed it.
bongobongo
Forum Members
Forum Members
Posts: 33
Joined: Thu Dec 11, 2008 11:41 pm

Re: Language detection?

Post 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?
alby

Re: Language detection?

Post 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
bongobongo
Forum Members
Forum Members
Posts: 33
Joined: Thu Dec 11, 2008 11:41 pm

Re: Language detection?

Post 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?
Locked

Return to “[locked] CMSMS MLE fork”