Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > How to automatically show preferred language to anonymous users View modes: 
User avatar
Member
Member
lancetek - 3/14/2013 3:38:01 AM
   
How to automatically show preferred language to anonymous users
Hi,
In our multicultural website, I'd like to be able to detect a browser's preferred culture and redirect the browser to the version of the page in their preferred language.

eg: If someone arrives at the site with es-ES as their preferred language ([es-es] [es;q=0.8] [en-gb;q=0.5] [en;q=0.3] ), I'd like to show them the Spanish version of the page, rather than the default (en-US) version.

FYI - We currently are using the standard Kentico language dropdown to allow people to flip between languages, but it'd be nice to have the application automatically show them their preferred language (if it's available)

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 3/20/2013 6:35:49 AM
   
RE:How to automatically show preferred language to anonymous users
Hello,

Following our e-mail converstaion you will also to need create a custom Global Event which will handle this.

The same events:
• CMSRequestEvents – contains events related to each request done to the application.
-> • Begin – fired when the begin request method executes.

Or you can also just create some custom methods and call them in the file: \App_Code\Application\CMSAppBase.cs

Where you will modify the method CMSBeginRequest().

In the code behind you will need to check the browsers language.. but for this purpose you can probably use some .NET libraries or just Google for some information (e.g.: Web Browser Language Detection).

Best regards,
Martin Danko