More in this section

Forums / Developing with Sitefinity / Localization - Change Language Code

Localization - Change Language Code

4 posts, 1 answered
  1. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    11 Mar 2010
    Link to this post
    Hi there,

    I have used the localization inside sitefinity for my website with persistenceMode="PathPrefix". However I have only two languages and in my master page i have a Hyperlink that shows the name of the other language available, let's say i'm in the English version so i have think Hyperlink on the top of my master page saying "Italian". What i want to do is to be able to change the language through code instead of using the Language bar that's shipped with Sitefinity because i only have these two languages. 

    Another problem that i'm having is that i have couple of links on my master page that redirects to external pages [I have added these pages to sitefinity and set the external link]. When i'm in the italian version and i click on one of these links in the master page, i'm redirected to the default version which is english while i should be redirected to the italian version of this page i.e. Contact us [Contact us is a custom form that i have created as external page in visual studio]

    Appreciate your help in advance.

    Best Regards,

    G
  2. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    11 Mar 2010
    Link to this post
    One more thing, i have tried to set the culture for the current thread and as i understood from the different topics that i have read is that i somehow need to set the culture for the CmsHttpModule

    Thanks
  3. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    12 Mar 2010
    Link to this post
    Hi G-force,

    Thank you for using our services.

    The language drop down control which we provide within Sitefinity is populated only by the languages you have enabled in your web.config. In order to set the culture manually you should change the CurrentThread.CurrentCulture setting and redirect to the same page with reworked URL so that the new language is in the path prefix. Bellow is sample how to change the current thread's culture:
    System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US");
    System.Threading.Thread.CurrentThread.CurrentCulture = culture;
    //then redirect to the same url with en path prefix


    Best wishes,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  4. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    13 Mar 2010
    Link to this post
    Thank you !
Register for webinar
4 posts, 1 answered