Developer forum

Forum » CMS - Standard features » Automatic language selection based on browser settings

Automatic language selection based on browser settings

Tymen NNM
Reply

Hi,

Our website currently has multiple languages which can be switched with a language dropdown box. The switch will add the correct country and language code to the URL e.g. en-US.

Now we would like to initially redirect the user to the page in the language of his/her browser settings when they enter the website with a url that does not specify the language.

 Is this possible by using standard features of DynamicWeb?


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Tymen

You can use HttpContext.Current.Request.UserLanguages in a Razor template, see http://stackoverflow.com/questions/18826282/detecting-browser-display-language

So if the URL does not have a language code, find the one from the browser, and locate the best match and make a redirect.

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum