Copied to clipboard

Flag this post as spam?

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


  • Chris Perks 32 posts 114 karma points
    Nov 13, 2013 @ 14:26
    Chris Perks
    0

    Umbraco 4.11.10 dictionary items in wrong culture

    Hi!

    I'm using Umbraco v 4.11.10 (Assembly version: 1.0.4926.14927)

    I have four cultures set up, hu-HU, pl-PL, cs-CZ and sk-SK. On some pages, I'm seeing dictionary items be pulled out in the 'wrong' culture.

    For instance, I ran this code from a Razor macro:

    Domain[] domains = library.GetCurrentDomains(Model.Id);
    var domainCulture = domains.First().Language.CultureAlias; //domains contains 1 result, hu-HU
    var culture = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; //pl-PL

     

    I'm not setting the CurrentCulture or CurrentUICulture manually anywhere in my codebase - so where is Umbraco looking before setting the thread culture? If this bit of code is not working for some reason, how can I find more information / logs / etc?

     

    Thanks,

    Chris.

     

     

  • Chris Randle 85 posts 199 karma points c-trib
    Nov 14, 2013 @ 15:17
    Chris Randle
    0

    Hi Chris,

    Great name btw! :-)

    I don't believe that the Umbraco culture lookup depends at all on the CurrentUICulture setting. It is purely dependant on the current domain and hostname used. Based on your example, you would have 4 different domains or subdomains (www + 3 subdomains). If you had a dictionary item on the home page, it would only lookup the value based on the hostname that you had configured against that node or one of its parent nodes. This is all based on the kind of CMS structure that uses a single branch (e.g. one landing page and child pages).

    In another kind of structure, you have 4 landing pages and Umbraco loads the appropriate landing page - based on the domain used. 

    Umbraco hasn't ever in the past had full browser culture support, and I don't believe it does now. The third and final solution might fit your predicament better than the other 2 more standard approaches. You have a single landing page and 4 home pages below this. You then do a Response.Redirect based on the CurrentUICulture, detecting the browser settings. However this is not recommended for a number of reasons, including the most basic of which is that users don't always set their browser language correctly.

    See this article for some more deails on the first 2 solutions.

    - Chris

Please Sign in or register to post replies

Write your reply to:

Draft