Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

Browser language detection broken

Open goren74 opened this issue 2 years ago • 4 comments

Description of bug

Hello, I have upgrade a website from 9.2 to 9.11 and now the detection of browser language is not done anymore if portal alias is not correct. I am able to reproduce issue 100% by downloading clean install of both versions from github.

Steps to reproduce

  • Create Website normally
  • Add a new language
  • Allow LocalizedContent, Enable Localized Content, Enable Browser Language Detection
  • Make the home page available for both default and new language
  • Go to Site Behavior -> Site aliases and unassign primary site alias without language (to force people having the language in the url)
  • Open incognito tab and browse home page (without any language in the url)

Current behavior

In 9.2 we were redirect to browser language, in 9.11 users are redirected to the default system language.

Expected behavior

Supposed to redirect to browser language

Affected version

  • [ ] 09.11.02
  • [ ] 09.02.00

Affected browser

  • [ ] Chrome
  • [ ] Firefox

goren74 avatar May 31 '23 13:05 goren74

Isn't that the expected behavior? If the users specifically goes to the URL that contains //, he wants to visit the site in that language.

The alias without language needs to be primary as well. The user goes to your website URL without language code he gets redirected to either the localized content in his language or the default language, if there's no alias for his browser lang.

Navilois avatar Jun 22 '23 06:06 Navilois

Thanks for the anwser but I think there is a misunderstanding. Let say I have a website which domain is mydomain.com, a page "Test" which is translated in german and french. Default system language German. If the user goes to //mydomain.com/test, before it was redirected to its native browser language. if user is french, redirected to mydomain.com/fr-fr/test and mydomain.com/de-de/test if german. Now regardless the browser detection language, user is redirected to de-de. And I think this is not desired behavior.

goren74 avatar Jun 22 '23 08:06 goren74

Did you try setting the alias without language primary as well?

Assign primary to:

  • mydomain.com
  • mydomain.com/de-de
  • mydomain.com/fr-fr

Clear cache, restart and try again.

Afaik, if you unassign primary of the alias without language, you skip the language detection and just get a 301 redirect.

Navilois avatar Jun 28 '23 17:06 Navilois

@goren74 did you try the suggestion noted by @Navilois

mitchelsellers avatar Jul 17 '23 03:07 mitchelsellers