Detection of browser language setting not working?

General questions regarding the use of languages in Joomla! 2.5.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
AntonAkola
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Thu Feb 03, 2011 3:21 pm

Detection of browser language setting not working?

Post by AntonAkola » Fri Feb 04, 2011 3:02 pm

I've followed the Language Switcher Tutorial for Joomla 1.6 but I've hit a wall when trying to enable the detection of browser language setting on first visit.

Both plug-in and module are enabled as per the tutorial. In the System - Language Filter settings, I've set Language Selection for new Visitors to Browser Settings. I can switch language by clicking on the Language Switcher flags and land on the intended home page for the corresponding language. So far, so good.

On first visit, though, I always land on the page for the default language as set in the Language Manager, irrespective of browser settings. I've been careful to do these test with emptied cache and no cookie stored. I've tried with FFX and IE, many browser settings, to no avail. HTTP header Accept Language seems to be utterly ignored.

Also, it looks like the Language Filter doesn't [* spam *] out pages in other languages in the navigation. Is this why the tutorial recommend to put articles in languages specific categories? Looks to me that with SEF enabled, this will result in strange looking URLs like /en/en-GB/...

So, has anyone succesfully used browser settings language detection in 1.6?

Is there a bug in navigation filtering?

What could I check in my settings if this look like some misconfiguration on my side?

Sennar
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Feb 04, 2011 9:50 pm

Re: Detection of browser language setting not working?

Post by Sennar » Fri Feb 04, 2011 10:37 pm

I too have this problem

My system's version are:

Apache/2.2.14
PHP/5.3.1
mod_perl/2.0.4
Perl/v5.10.1

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Sat Feb 05, 2011 3:58 pm

AntonAkola wrote: So, has anyone succesfully used browser settings language detection in 1.6?
I confirm. Will create a tracker.
Is there a bug in navigation filtering?
I do not understand what you mean here.
Could you give an example?
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

AntonAkola
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Thu Feb 03, 2011 3:21 pm

Re: Detection of browser language setting not working?

Post by AntonAkola » Mon Feb 07, 2011 3:52 pm

infograf768 wrote:I confirm. Will create a tracker.
Thanks for that. Could you point me to that tracker?
infograf768 wrote:
Is there a bug in navigation filtering?
I do not understand what you mean here. Could you give an example?
Quite simply that the page (article) navigation doesn't filter out articles in other languages than the one selected.

For instance, a menu module tagged with aa-AAA won't be displayed on the front-end if I select en-GB using the Language Switcher. Similarly, a menu module tagged with language All will be displayed, but not its menu options which language tags don't match the selected language. (That's handy by the way as it allows one to set-up and manage all languages with only one menu/menu module, and then for instance change the menu position in one operation for all languages.)

But in the case of the navigation buttons [< Prev] and [Next >], the navigation goes through all pages in the category (or all uncategorized articles), regardless of language. One would naturally expect that only pages tagged with current selected language would show in the navigation.

On the same topic, I find it a bit confusing that the articles order in the navigation start from the last article through to the first, in reverse order from the order set up in the Article Manager. But that may be a feature, not a bug?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Tue Feb 08, 2011 6:13 am

Thanks for that. Could you point me to that tracker?
http://joomlacode.org/gf/project/joomla ... m_id=24767
But in the case of the navigation buttons [< Prev] and [Next >], the navigation goes through all pages in the category (or all uncategorized articles), regardless of language. One would naturally expect that only pages tagged with current selected language would show in the navigation.
One should not set items in one specific category to different languages.
It is strongly advised for correct implementation to separate all for each language.
If you need to display in different content languages identical contents, just copy/move them to the other language specific category.

Also, the uncategorized category is present in 1.6 to deal with legacy 1.5 (and its section/category structure).
Forget it or get rid of it if you start a 1.6 site from scratch.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

AntonAkola
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Thu Feb 03, 2011 3:21 pm

Re: Detection of browser language setting not working?

Post by AntonAkola » Tue Feb 08, 2011 8:46 am

infograf768 wrote:
Could you point me to that tracker?
http://joomlacode.org/gf/project/joomla ... m_id=24767
Thanks again.
infograf768 wrote:One should not set items in one specific category to different languages. It is strongly advised for correct implementation to separate all for each language.
Thanks for the clarification. One will keep that in mind. Rules have to be enforced or...

Too bad we have to do that AND tag articles with languages though.

Looks like this reverse order navigation will not be that useful anyway, unless I get to override that in my template. Back to that then.

Sennar
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Feb 04, 2011 9:50 pm

Re: Detection of browser language setting not working?

Post by Sennar » Tue Feb 08, 2011 10:24 am

Excuse me if I write in this topic also my problem. As a guide, I've enabled the form "System - Language Filter", the menu page, as all have as their language: "All". I have created in the "Language Manager" the content it-IT and its front-end language. The automatic switching of language, I do not work. I did a debug code. In the processing of the function app-> route () in index.php. it is in the function __destruct () debug.php file, and executing the command "return" the following code:

if (!JDEBUG) {
return;
}

compile your code back to the index.php page reloading the entire site by disabling the active functions:

detect_browser 0
automatic_change 0

sorry for my horrible English

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Sat Feb 12, 2011 7:17 am

The browser detection and switch depending on user language (cookies) has been corrected in trunk
It will be available in 1.6.1
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
jojo7
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Thu Apr 12, 2012 11:00 pm
Location: München
Contact:

Re: Detection of browser language setting not working?

Post by jojo7 » Thu Apr 12, 2012 11:41 pm

Hello,

language selection by browser language setting
stoped working after update joomla! 2.5.3->2.5.4. on local install using firefox 11.0
(and on the multilingual demo site?
http://multilingual.demojoomla.com - though not shure, if it is set to do so).

Can anybody reproduce/confirm this, or am I missing something?

thanks and greetings, chris

AntonAkola
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Thu Feb 03, 2011 3:21 pm

Re: Detection of browser language setting not working?

Post by AntonAkola » Fri Apr 13, 2012 5:16 am

jojo7 wrote:language selection by browser language setting stopped working after update joomla! 2.5.3->2.5.4. on local install using firefox 11.0
There was indeed some changes in multilanguage functionalities with this version but everything is still working as it should for me after the update (you might want to check up this new setting anyway).

Other than that, I have no idea what your problem might be.

As a side note, the browser used should make no difference whatsoever on this functionality, provided that its setup is really what you need for your tests (double check that, maybe).

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Fri Apr 13, 2012 7:47 am

jojo7 wrote:Hello,

language selection by browser language setting
stoped working after update joomla! 2.5.3->2.5.4. on local install using firefox 11.0
(and on the multilingual demo site?
http://multilingual.demojoomla.com - though not shure, if it is set to do so).

Can anybody reproduce/confirm this, or am I missing something?

thanks and greetings, chris
Using lang selection by browser language settings may work ONLY for the first time the site displays.
Thereafter, as a cookie is set, it is the last content language used that will display.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

AntonAkola
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Thu Feb 03, 2011 3:21 pm

Re: Detection of browser language setting not working?

Post by AntonAkola » Fri Apr 13, 2012 10:50 am

infograf768 wrote:Using lang selection by browser language settings may work ONLY for the first time the site displays. Thereafter, as a cookie is set, it is the last content language used that will display.
Good point. I forgot to mention this as the most probable cause. It might be a good idea to set Firefox in Private browsing mode to do language selection tests, if removing cookies or setting up automatic cache emptying (and cookie removal) is too much of a hassle.

User avatar
jojo7
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Thu Apr 12, 2012 11:00 pm
Location: München
Contact:

Re: Detection of browser language setting not working?

Post by jojo7 » Fri Apr 13, 2012 8:49 pm

hi, thanks for your replys, did some testing (IE8+FF11 and cookies deleted everytime) :
win xp, new xampp, new local install j2.5.4, two languages:
language by browser setting stopps working when SEO is turned on, ok when off,
no problem with j2.5.3 - works perfekt with SEO!
any ideas, maybe cookie path settings (left fields blank on both versions), or a bug?

multilanguage-demo-site allways starts english for me (cookies deleted, browser set to german) - is that normal/wanted behavior? hm, if not, do you see another language on start (cookies deleted, browser set to one of the other installed languages-not english)? (I can see in BE it's 2.5.4, but can't access the System-Language-Filter-plugin, so I don't know the settings (would be nice though))

found related post by akasht, Sat Apr 07:
http://forum.joomla.org/viewtopic.php?p ... 8#p2782978

any hint/help is welcome, thanks for taking some time

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Sat Apr 14, 2012 9:22 am

It looks like this issue is due to the setting: Remove URL Language Code (for the default site language) in the languagefilter plugin.

Looking into this.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
jojo7
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Thu Apr 12, 2012 11:00 pm
Location: München
Contact:

Re: Detection of browser language setting not working?

Post by jojo7 » Sat Apr 14, 2012 9:49 am

great, it works with 'Remove URL Language Code' turned off and SEO on, thank you so much!

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Sat Apr 14, 2012 2:21 pm

It is a bug though that was introduced in
http://joomlacode.org/gf/project/joomla ... m_id=28151
Please test this replacement file:
{new file below}
Decompress and replace plugins/system/languagefilter/languagefilter.php

Test again with URL Language Code set to Yes (after clearing Cookies)

Tracker open:
http://joomlacode.org/gf/project/joomla ... m_id=28407

If this works for you, please comment on tracker.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
jojo7
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Thu Apr 12, 2012 11:00 pm
Location: München
Contact:

Re: Detection of browser language setting not working?

Post by jojo7 » Sat Apr 14, 2012 5:47 pm

still same behavior,
even with cookies not cleared, when i start the site in a new tab, it starts with default language (with URL Language Code set to Yes).

kharmer
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Thu Feb 19, 2009 9:57 am
Location: Cambridgeshire / Hertfordshire, Great Britain, Centre of the Universe
Contact:

Re: Detection of browser language setting not working?

Post by kharmer » Wed May 16, 2012 9:14 am

I've just stumbled upon this problem on a new project I've literally just started!

J! 2.5.4
SEF enabled
Lang switch plugin enabled
Lang switch module published (but I don't want this really!)
EN and FR setup with test articles and test lang specific menus and menu items as outlined in the articles: http://docs.joomla.org/Language_Switche ... Joomla_1.6

I've tried all combinations of configuration but no joy! It always defaults to EN!

Has anyone found a solution yet by any chance?
Joomla CMS Developer: http://www.kharmer.co.uk

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Wed May 16, 2012 9:44 am

We have reverted a wrong patch and corrected the file for 2.5.5.
Here is the present replacement file for languagefilter.php
languagefilter.php.zip
Decompress and replace plugins/system/languagefilter/languagefilter.php
You do not have the required permissions to view the files attached to this post.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

kharmer
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Thu Feb 19, 2009 9:57 am
Location: Cambridgeshire / Hertfordshire, Great Britain, Centre of the Universe
Contact:

Re: Detection of browser language setting not working?

Post by kharmer » Wed May 16, 2012 10:07 am

Thanks very much for your speedy response.

I've tried replacing the file you supplied in the post above and having tested am still getting the same result! It seems to persist to always default to the default language (EN).

I do still have SEF enabled; however SEF is a must in this instance.

To test, I have chrome setup using FR language. When I was trying to debug this lang switcher plugin it appears that the value returned by 'JLanguageHelper::detectLanguage()' in the 'buildRule' method is always returning 'en-GB'. I'm outputting values in this method to screen and I can see at first no language is set by cookie and then the 'detect browser' returns a true value but then when detecting browser language immediately after it always returns 'en-GB'!

Might be barking up the wrong tree but thought I'd mention it.

Thanks again...
Joomla CMS Developer: http://www.kharmer.co.uk

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Wed May 16, 2012 10:14 am

Normally should depend on the Languagefilter plugin parameters.
Check these please.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

kharmer
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Thu Feb 19, 2009 9:57 am
Location: Cambridgeshire / Hertfordshire, Great Britain, Centre of the Universe
Contact:

Re: Detection of browser language setting not working?

Post by kharmer » Wed May 16, 2012 10:39 am

Sure, here are my current settings for the language switcher plugin.

Language Selection for new Visitors: Browser Settings
Automatic Language Change: Yes
Menu associations: Yes
Remove URL Language Code: No
Add alternate meta tags: No

Thanks again for your help,
Kris...
Joomla CMS Developer: http://www.kharmer.co.uk

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Wed May 16, 2012 2:53 pm

Is it clear for you that browser settings is only used for first visit?
I.e. after first visit, a cookie is set and it is the last language displayed that will be used?

To test (wiht the file above), you have yo delete all cookies first.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

kharmer
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 110
Joined: Thu Feb 19, 2009 9:57 am
Location: Cambridgeshire / Hertfordshire, Great Britain, Centre of the Universe
Contact:

Re: Detection of browser language setting not working?

Post by kharmer » Wed May 16, 2012 3:41 pm

Yeah - each time I retried I completely cleared cookies/cache/history just to be sure.

I'm tempted to install 2.5.3 just to see if my configuration is correct as I've read that this problem with automatic language detection only came about from 2.5.4!

Cheers,
Kris...
Joomla CMS Developer: http://www.kharmer.co.uk

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Wed May 16, 2012 4:28 pm

Please send me a pm with superuser access and I will have a look (make sure that le plugin file has been updated to the one above)
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

alin09ro
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Aug 16, 2011 5:23 pm

Re: Detection of browser language setting not working?

Post by alin09ro » Sat Jun 09, 2012 4:38 pm

Hi.

I have set up En, FR & Es languages on a site.
everything works fine (the languages are changing, no problem with the click on Home or logo) but I have this problem:


Now if I select for ex: Spanish and I close the browser window, the next time I open it the site language is Spanish. I wold like that every time I open the browser the language to be English (the default one).

How can I do that?

Thanks

Alin

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Sat Jun 09, 2012 5:42 pm

You can't change this behavior. As stated above, a cookie is set when you display a specific Content language and changes depending on the last Content Language displayed.
To get rid of this cookie would necessitate a core hack of the languagefilter plugin
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

alin09ro
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Aug 16, 2011 5:23 pm

Re: Detection of browser language setting not working?

Post by alin09ro » Sat Jun 09, 2012 5:47 pm

but the demo site http://multilingual.demojoomla.com works exactly like I want...

I select a language and if I close the browser the next time I open it's still English the default one.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Detection of browser language setting not working?

Post by infograf768 » Sun Jun 10, 2012 6:22 am

Are you testing with the new languagefilter file posted above?
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

alin09ro
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Aug 16, 2011 5:23 pm

Re: Detection of browser language setting not working?

Post by alin09ro » Sun Jun 10, 2012 6:40 am

Yes the languagefilter.php file is the one posted above . Can you tell me what to change to get the desired result?

Thanks.


Locked

Return to “Language - Joomla! 2.5”