Try Now
More in this section

Forums / Developing with Sitefinity / Culture in generic handler

Culture in generic handler

2 posts, 0 answered
  1. Dee
    Dee avatar
    1 posts
    15 Oct 2013
    24 Oct 2013
    Link to this post

    I need to implement a site to support different lanaguages. Sitefinity handles showing details of items in different languages by redirecting the user to a language specific URL.

    In my case, I need to show details of the child items from a dynamic module on the same page without a redirect. So I am making an ajax call to a generic handler to fetch child item details and display on the site. The problem is when the language is changed using the language selector, the custom widget gets proper culture in Thread.CurrentThread.CurrentUICulture but the handler gets the settings from the browser.

    Is there a sitefinity setting that can be accessed in the handler to fetch culture and then culture specific details using  x.GetString("Title", culture) extension method?
  2. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    26 Mar 2015
    28 Oct 2013
    Link to this post
    Hello Dee,

     What I can suggest based on the information so far is something like this:

    Thread.CurrentThread.CurrentCulture = new CultureInfo("fr");
                    var title = item.GetValue("Title");

    The code will get all french titles. This method can be useful if you know how many cultures your site and then assign the above snippet to the cultures you wish to display. It will involve augmenting your logic. Regards,
    Ivan D. Dimitrov
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered