Copied to clipboard

Flag this post as spam?

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


  • J 351 posts 606 karma points
    Nov 13, 2019 @ 10:01
    J
    0

    Create multi country/language site

    I need to create a multi site based on different countries. A site for each country. After researching around i believe i need to do the following under ONE umbraco installation:

    Create a new site under Content for each country. Create a new template and set the lang on each template for the country in question. For each site set the appropriate culture/hostname

    Does this sound correct? If yes i would like friendly URLs for each country so if the URL is similar to

    https://unitedkingdom.co.uk/products/item/1/nameOfProduct https://france.co.fr/products/item/1/nomDuProduit

    1. How could i set UrlRewriting.config up to take care of each country?
    2. The product name would come from my database table which i would program using forms. I assume i would need to record each product name in the appropriate language?

    Appreciate any guidance or articles that anyone could point me to.

  • Patrick van Kemenade 69 posts 263 karma points
    Nov 13, 2019 @ 10:55
    Patrick van Kemenade
    0

    I think I've setup something similar as what you want.

    I've (just) created site https://onlinegroeicoach.nl/ if you open it and click on the English flag you get the same page on domain https://onlinegrowthcoach.com/ this also works for every subpage.

    To get this setup first in Settings, create all the languages you need.

    Then in Content create a Content item for instance Home. Right click on it and select Manage Cultures and Hostnames (kind of strange place to hide this option I think, but anyway).

    Here put in domains / languages.

    From now onwards you can edit every content item you create in multiple languages (let's assume you have 2).

    In IIS you have 2 domains setup, each pointing to the same physical www location. If you run 1 website it's probably fine. When you run both websites at the same time from your browser you'll get an error indicating something is locked.

    This one was a bit tricky, found I had two add the following to appSettings (using Umbraco 8.1, added it just before the tag).

    <add key="Umbraco.Examine.LuceneDirectoryFactory" value="Examine.LuceneEngine.Directories.SyncTempEnvDirectoryFactory, Examine" />
    

    Not exactly sure what it does exactly, tried several things when encountering this error found this one somewhere on a forum and it worked.

    I guess you know how the IIS setup works, so with this I think your set.

    Suppose you have a field called HeadLine, when you create 1 template calling @Model.HeadLine, and in the Content you created the headline in two languages it will work out-of-the box.

    In my case I also wanted a language switcher, so on the Dutch page I needed a reference to what is the corresponding English url, this is what did the trick for me: @Model.Url("nl", UrlMode.Absolute) @Model.Url("en-us", UrlMode.Absolute)

    So you only need 1 template and it can serve multiple languages/sites. So no need to create separate templates/doctypes for each language. Only in the Content editing you typically edit in split view with all fields in 1 language on the left and the other language to the right.

    Other code to use inside a template to get alle the languages available for this page and perhaps do something additional with it could be:

    var currentLang = $"{CultureInfo.CurrentCulture.Name} - {CultureInfo.CurrentCulture.NativeName}"; // Detect current language
    var langs = Umbraco.ContentAtRoot(); // Show all available laguages
        foreach(var lang in langs){
            <b>
                @lang.Name
            </b>
    

    For me the really good way Umbraco handles multisite/multilanguage was the number 1 reason to switch to Umbraco recently.

    Hope this helps, good luck !

  • Mikael Axel Kleinwort 69 posts 312 karma points c-trib
    Nov 13, 2019 @ 12:31
    Mikael Axel Kleinwort
    0

    Patrick,

    I wonder why you have set up 2 different sites in IIS. Until now, for a multi-lingual site, I just set up one IIS site with several domain names in the site's bindings, but this was prior to me working with Umbraco. Is there a benefit with the 2-site approach I am not aware of? Just curious...

    Regards, Mikael

  • Patrick van Kemenade 69 posts 263 karma points
    Nov 13, 2019 @ 13:32
    Patrick van Kemenade
    0

    Thanks for asking.

    Think your right, reason I did it was because I thought I needed a separate SSL account (Let's Encrypt) for each top level domain.

    But I think if you create 1 multidomain SSL certificate this should also work.

  • Mikael Axel Kleinwort 69 posts 312 karma points c-trib
    Nov 13, 2019 @ 23:24
    Mikael Axel Kleinwort
    0

    Patrick,

    in IIS, you can assign different ssl certificates to each binding (protocol / hostname / IP combination), this way, you can use several regular ssl certificates for one IIS site. Of course, a wildcard or multi-domain certificate would work just as well.

    Regards, Mikael

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies