Site structure
Version 5.x > Site structure > URL with parameter "lang" View modes: 
User avatar
Member
Member
cadi2108 - 12/21/2011 5:54:12 AM
   
URL with parameter "lang"
Hello, I'm create multilingual website with two languages, my national and English. When I click in languageselector link, i have URL like

localhost/Home.aspx?lang=en-US

But when I click in menu (generated by CMSMenu), i have:

localhost/Home.aspx

Is any method to set Kentico to check current culture and add parameter "lang" to my URL?

User avatar
Member
Member
kentico_michal - 12/26/2011 10:24:28 PM
   
RE:URL with parameter "lang"
Hello,

The lang Url parameter is a special query parameter. Its presence in the Url indicates that Kentico CMS should change the current culure if the current culture is different from the value specified in the lang parameter.

The Url with this parameter needs to be created manually. You can use the following method to add the lang parameter to a particular Url

string url = URLHelper.AddParameterToUrl(currentUrl, "lang", cultureCode);


To check / change the current culture using API you can use the following property: CMS.CMSHelper.CMSContext.CurrentUser.PreferredCultureCode.


Best regards,
Michal Legen