Search code examples
c#asp.netwebumbraco

Several questions to implement multi lingual functionality with Umbraco?


I'm struggling to implement the multilingual functionality in Umbraco CMS version 7.5, currently i see 2 possible solutions:

1- Use only one root path

I think the best package as a complement for this solution is "Vorto", all I have to do is create new data types which extends the vorto data types and I can start edit texts directly on document types.

2- Use multiple root path

The idea is to duplicate the main root path for each language.

-> I followed a lot of tutorials on the web but they all relate on previous versions of Umbraco and the solutions i found seem not working with the current version... Once i duplicate the root path and i associate the language to the root folder, what's the next step ?

I have a few more questions:

  1. Do you have a better solution than the 2 on top ?
  2. How Umbraco knows the client language ? Does it take the first language in the header "Accept-language" in the HTTP request ?
  3. How could i extend the default routing to add the language as the first part, for example: http://domainName.ext/language/....

Thank you by advance !


Solution

  • Both scenarios have their pros and cons and both are widely used in the Umbraco community / solutions. I prefer 2nd solution, as especially on larger sites it gives you ability to restrict access for different language editors for example and not each site has a requirement to be 1-1 content structured.

    There is an Umbraco TV episode covering this topic here: https://umbraco.tv/videos/umbraco-v7/implementor/multi-lingual/creating-a-multi-lingual-site/introduction/.

    In summary:

    • you need to create copy of your root language node
    • then setup the culture for it
    • use dictionary items to translate static content for each language
    • create simple language picker choosing related site or just redirecting to selected language root

    Regarding your questions:

    Ad.1. I don't have :)

    Ad.2. It's selecting culture set up on the node(s), so it may be forced. Other than that it use standard .NET culture detection, so yes - it's using "accept-language" headers.

    Ad.3. There is a key "umbracoHideTopLevelNodeFromPath" which enables you to include top level roots in the url paths. Read more: https://our.umbraco.org/documentation/reference/config/webconfig/

    And still, if you prefer to go with option 1, there is an awesome article about it with example code as well: http://24days.in/umbraco/2015/multilingual-vorto-nested-content/. I will be playing with it now too! :)