Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Scott 69 posts 146 karma points
    May 13, 2013 @ 22:42
    Scott
    0

    What sets the language contour uses on a multi-lingual site

    I'm using the umbraco 1:1 multi lingual site setup, and it works fine when switching languages by directing the user to the hostname for each language. I have a weird scenario where regardless of hostname I want to be able to change languages based on a query string. I have about 75% of the site working this way...but not contour. Under normal circumstances contour DOES switch languages, using a dictionary to set the field labels for the appropriate language. Its just under the oddball scenario where I'm forcing a language switch regardless of the hostname. What I'm trying to do is something like:

    www.myspanishsite.com/path/pagewithform.aspx?lang=en and have it show in english. I thought on the template the form is on I could detect the querystring and then use this to set the culture, but it doesn't work:

     

    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(language);

    Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);

    Is there a way I myself can override the language/culture that umbraco is trying to use rather than what umbraco thinks mysite should be using? 

     

  • Scott 69 posts 146 karma points
    May 14, 2013 @ 14:55
    Scott
    0

    Continuring to research with no luck. I have a master template that derives from the umbraco default.master. In my master, in the page_load I'm forcing a culture to en-US as a test. Then in my sub-template that hosts my contour form I've done the following:

    Language Culture: <%=CultureInfo.CurrentCulture.EnglishName%<br />
       <form runat="server">
        <umbraco:macro FormGuid="059c4c4b-5a9f-46e3-89af-7df0930dcc85" Alias="umbracoContour.RenderForm" runat="server">umbraco:Macro>
      form>
      Language Culture: <%=CultureInfo.CurrentCulture.EnglishName%<br />

     Hitting my spanish language site, even with the forcing of the culture to en-US the contour form field names are still showing the spanish dictionary values. But the debug info I have wrapped around my form shows "English (United States)".  So I'm not setting the culture at the right spot or something. Still looking for some guidance.

    Thanks.

     

  • Comment author was deleted

    May 15, 2013 @ 11:31

    And how do your dictionary items behave in that scenario, Contour just uses dictionary items and I guess that will always look for the language set on the node structure

  • Scott 69 posts 146 karma points
    May 15, 2013 @ 14:40
    Scott
    0

    So from what your saying contour is not referring to the culture at all but instead actually looking up the language based on where the page is in the content tree.... then I guess I'm out of luck.

  • Comment author was deleted

    May 15, 2013 @ 15:24

    Yeah it's just using umbraco dictionary items under the hood so that assumes you have a language set on your node structure

  • Scott 69 posts 146 karma points
    May 15, 2013 @ 15:30
    Scott
    0

    Sounds like I need a different course of action then, maybe just some type of redirector to send me to the correct language page rather than forcing the page itself to flip languages. What I anticipated from the start but thought I'd try this path first. If nothing else I've learned a bit.

Please Sign in or register to post replies

Write your reply to:

Draft