Copied to clipboard

Flag this post as spam?

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


  • Neil Fenwick 86 posts 63 karma points
    Feb 22, 2010 @ 12:27
    Neil Fenwick
    0

    Seperating "language" from "hostname" in Umbraco

    I've searched around and I've not yet found anyone who's written about this particular topic yet.

    I am building a relatively straight-forward Umbraco site, and about the most complex part of it is that it has multiple domains and is multi-lingual.  Most of the information I have found in the forum, Umbraco book and blogs leads to the 1:1 multi-lingual pattern, or multiple top-level-domain content nodes.

    Where the model seems to break down is that the site that I am building has multiple domains / regions (each with a default language), but that *each region/domain* may also be multi-lingual.

    When following an example pattern like this:

    Content
         |
         -- Home.be
         |     |
         |     -- en
         |     |     |
         |     |     -- About
         |     |     |
         |     |     -- Contact
         |     |
         |      -- nl
         |         |
         |         -- Personen
         |         |
         |         -- Contact
         |
         -- Home.dk
         |     |
         |     -- en
         |     |     |
         |     |     -- etc. etc.
         |     -- dk
         |           |
         |           -- etc. etc.

    Home.be may have its hostname set to Home.be, and default language set to Dutch (Nederlands).

    The actual content that is entered into the sub-branches, (en, nl, dk, etc....) is not a problem at all, because that content can just be entered input in the correct language (including the page names).

    My questions below are about the best method to render the shared parts of the site, like the home page, and still be able to use the same Document Types & Templates for each domain.

    For example, the Home.be landing page, may have a panel that displays country names from the Umbraco dictionary...

    ...therefore the country names will be rendered in Nederlands, the default language for the Home.be hostname, because Umbraco appears to be setting the Thread and Thread UI culture based on the domain name when the page loads (using HttpContext.Current.Request.ServerVariables["SERVER_NAME"] to match against the domain name set against the root Content node).

    Questions:

    1. if I added a dropdown / link to change the language of the page, so that the country names would render with the English values from the dictionary, it appears that I would have to write a control / component to change the Thread and Thread UI culture again, to override the language that Umbraco has pulled along with the hostname.  Is that the way most would do it?  Making sure I'm not missing a trick here...

    2. I get the Umbraco can do multiple domains and multiple languages, but at the moment, it appears to be limited to one language per domain unless you start writing code... Is that correct?

     

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 22, 2010 @ 12:54
    Dirk De Grave
    0

    Neil,

    Haven't tried it so should check it out, but maybe your region/domain nodes can also accept a bogus domain name, and set language/culture for each of the region nodes (and their child nodes)?

  • Neil Fenwick 86 posts 63 karma points
    Feb 22, 2010 @ 13:20
    Neil Fenwick
    0

    Thanks Dirk,

    It was a nice idea to use fake hostnames to try to get Umbraco to use the culture selection and I gave it a quick try.  Unfortunately, I must set the hostname on the site root (e.g. Home.be and Home.dk) to get Umbraco to render those home pages when the user types http://home.be into their browser.  Otherwise Umbraco will just render the content for the default Home.com node (not shown in the tree above).

    It appears you can't nest hostnames (that would probably not make sense anyway).

    So far it still looks as if I'll need to find a way to override just the culture, within one of the sites.  Its not really much of a problem, because I need to add some functionality to take the language branches into account when drawing the navigation & menus - I probably just add the code to change the Thread culture at the same time.

    (ps all Home.xx hostnames I've used above are just examples I used for this question)

  • Laurence Gillian 600 posts 1219 karma points
    Feb 22, 2010 @ 17:50
    Laurence Gillian
    0

    Ah this is cunning! I think you can only have 'one language' per domain and you can't have nested hostnames, however this is nothing stopping you from working in the way you have shown and using a lang selector to allow the correct content to be driven into the pages.

    You should still be able to mirror the content on the regions with a relationship, so you can just write your XSLT to deliver the content based on the current relationship which I guess could be stored as a cookie, or session state?

    Lau

Please Sign in or register to post replies

Write your reply to:

Draft