User tests: Successful: Unsuccessful:
There is currently an issue that the cookie setting isn't respected when you access www.example.com. If you visited the site before and switched the language, it should actually redirect you to that language but it currently will always redirect to the site default language.
There are already several PRs which are trying to solve this issue. Most of the did detect a part of the problem, but missed another part.
So this is my attemp to merge the best from various PRs to try to get this solved. Hopefully I didn't miss anything myself
What I did:
cookie_path
, which now defaults just to /
like we do in all other instances where we set a cookie within our CMS.Labels |
Added:
?
|
Much better! Now cookie works OK with URL Language Code removed.
I still get an issue here
Settings:
1. Browser set to en-gb as preferred language
2. Default site language set to fr-FR
3. Settings for Global Configuration:
Delete all cookies. Quit browser. Relaunch browser. Enter tld root.
Result: the site default language loads (fr-FR) instead of the Browser setttings language (en-GB)
This happens only when url language code is removed.
Tested with this code:
// If the default prefix should be removed and the SEF prefix is not among those
// that we have in our system, its the default language and we "found" the right language
if ($this->params->get('remove_default_prefix', 0) && !isset($this->sefs[$sef]))
{
$lang_code = $this->app->input->cookie->getString(
JApplicationHelper::getHash('language')
);
if (!$lang_code && $this->params->get('detect_browser', 0) == 1)
{
$lang_code = JLanguageHelper::detectLanguage();
}
if (!$lang_code)
{
$lang_code = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
}
if ($lang_code == JComponentHelper::getParams('com_languages')->get('site', 'en-GB'))
{
$found = true;
}
}
else
[...]
and looks like it corrects the issue here.
Added suggestion by @infograf768. Worked when I tested it.
Category | ⇒ | Authentication Multilanguage |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-03-16 13:48:16 |
Milestone |
Added: |
This issue has not been fixed, cookie language is not remembered
@xpallicer
You should test on 3.4.1 and make sure to tick Year for the cookie time in the languagefilter, so that the cookie still exists after quitting the browser and relaunching.
Hello infograf,
Did this: update to Joomla 3.4.1, delete all site's cookies. Access mysite.com/es, access mysite.com I get redirected to my browser default language (I should be redirected to mysite.com/es again)
After accessing mysite.com/es, quit the browser and then relaunch and use mysite.com
Now it works. I think the bug persists if you do not update (save) Joomla global configuration. Thank you. Best regards!
The config don't matter. What is important is that you cleared the cookies. Especially the one with the path set to something else than /
(root)
I cannot get this to work under 3.4.3 as it used to under 3.1.5 (yes I had put off upgrading for some time since initial upgrade failed). I followed this process:
Using Firefox 39.0 clear all cookies
Check Language Filter settings via http://saatalk.info/administrator
Language Selection for new Visitors: Browser Settings
Automatic Language Change: Yes
Item Associations: Yes
Remove URL Language Code: No
Cookie Lifetime: Year
Add Alternate Meta Tags: Yes
Check http://saatalk.info
Correctly redirected to http://saatalk.info/en in line with browser settings
Cookie containing en-GB stored on path /
Select Deutsch via language switcher on http://saatalk.info
Correctly redirected to http://saatalk.info/de
Cookie containing de-DE stored on path /
Check http://saatalk.info
INCORRECTLY redirected to http://saatalk.info/en
Cookie containing en-GB stored on path /
What I want to happen is for the language to be specified by the following in order of priority:
1. via the URL
2. via the Language Switcher
3. via the Browser Settings
This is indeed what happened under 3.1.5 and reading about the clever work done in this thread I thought it was what you guys were aiming at too. Now it seems to be ignoring point 2 entirely, and the Language Switcher just sets the the URL in menu items, ignoring the cookie entirely for any other URL without a language specification. Am I still doing something wrong?
- via the URL
- via the Language Switcher
- via the Browser Settings
The language switcher is the same as "URL". So you either have "URL" or "browser settings". URL obviously has priority over browser settings.
What you mean is the cookie value which gets ignored. But only if Remove URL Language Code
is disabled. If it's enabled all seem to work fine.
@chrisxchrisxchrisx
Can you please open a new issue? Because it will not get fixed when you comment on a closed PR.
(Hopefully) fixed codestyle and removed some unneeded code based on suggestions from Hannes. Thanks!