Copied to clipboard

Flag this post as spam?

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


  • Azamat Ismagulov 10 posts 30 karma points
    Jul 02, 2014 @ 07:14
    Azamat Ismagulov
    0

    Multilingual site

    Hello,

    Can you please advice how to create multilingual site? If possible starting from the creating document type, ending manipulation with dictionary.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 02, 2014 @ 08:38
    Dennis Aaen
    1

    Hi Azamat,

    The way I would do it´s it by create the documenttypes and templates for the first site, after you have finnish the site, then I would then take a copy of the exseting site content, and add and change the culture and hostnames so it point the right langagues. And remember to setup the new url in bindings in the IIS.

    Here are some documentation how to creating a Basic Website using Umbraco v7.1 http://our.umbraco.org/documentation/Using-Umbraco/Creating-Basic-Site/

    The way that you can make labels or pure text multilingual is by using dictionary. You can use dictionary items directly in templates or in partial views, partial view maros, usercontrols or XSLT. Here are some documentation on how to work with dictionary items in razor http://our.umbraco.org/documentation/reference/templating/macros/razor/using-dictionary-items

    If you´re using Umbraco 7, and want to insert a dictionary in to the template it can be done by doing this, (if you are in the Umbraco backoffice on a template you have a button you can click to insert dictionary items into the template)

    @Umbraco.Field("#NameOfDictionary")

    If you´re using webforms it would look like this:

    <umbraco:Item field="#NameOfDictionary" runat="server" />

    If you need your backend labels for the fields you have on page to be translated too, it can be done aswell, see this documentation here: http://our.umbraco.org/documentation/Using-Umbraco/Multilanguage-Setup/

    And the last thing I would recommend you to do is, if you haven´t access to the Umbraco TV, then I think at you could signup there are super videos about the basic concepts of Umbraco including working with multilingual site. http://umbraco.tv/videos/implementor/multi-lingual/creating-a-multi-lingual-site/introduction/

    In the chapter about how to work with multilingual site there are going through these topics:

    Introduction

    Copying and translating content

    Setting up the languages

    Assigning languages

    Creating dictionary items

    Using dictionary items

    Adding the language to the url

    Adding a language switcher

    Hope this helps, and make sense. If not don´t hesitate to ask further questions, then I will try to help you.

    /Dennis

  • Azamat Ismagulov 10 posts 30 karma points
    Jul 02, 2014 @ 08:45
    Azamat Ismagulov
    0

    Thank you Dennis, much appreciated for your soon reply.

    Very helpful information.

  • Azamat Ismagulov 10 posts 30 karma points
    Jul 02, 2014 @ 14:44
    Azamat Ismagulov
    0

    I've created folowing Document types:

    Main
    -Home page
    --Text page
    --News
    ---News single page

    In Content I have following structure:

    Content:
    -EN (home page) domain hostname: url: /, domain.com/ www.domain.com/, domain.com/en www.domain.com/en
    --Text page
    --News
    ---News single page

    -RU (home page) domain hostname: url: /, domain.com/ru www.domain.com/ru
    --Text page
    --News
    ---News single page

     Is that right?

    Second question, on my master Layout I've put Razor Navigation Macros, so now I have duplication of navigation (Home En, Home Ru, Text page en, Text page ru a etc.).

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 02, 2014 @ 17:16
    Dennis Aaen
    1

    Hi Azamat,

    To me it sound like you are on the right direction with your content structure

    But when you say that you added Navigation Macros on the master Layout, it sounds to me that you have individual razor macros for each langauge, if that´s your setup now, it´s not the right way to do. You should use the same razor macos,on all langaue. So you only have one nagavigation macro, breadcrumb macro and so on.

    Hope this helps, and make sense.

    /Dennis

  • Azamat Ismagulov 10 posts 30 karma points
    Jul 05, 2014 @ 17:19
    Azamat Ismagulov
    0

    Could you explain this please "You should use the same razor macos,on all langaue.". So it means that I need to use different layouts for the each language? Do you have any links on this or relevant subject. Thanks.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 05, 2014 @ 17:42
    Dennis Aaen
    0

    Hi Azamat,

    You should only have one set layouts that you use, for all the sites, so it will use the same layouts (Master layout pageLayout and so on), and have the same basic design. And therefor you should also use the same macro for each sites for pull data out of Umbraco for submenus main menu and so on.

    So your setup is 1 set layouts for all your pages and use the same marcos for pulling out data from Umbraco.

    If you have any text og labels that should be langauage versioned, then use dictionary items. And again I would recommend you to see the videos about creating multilingual site http://umbraco.tv/videos/implementor/multi-lingual/creating-a-multi-lingual-site/

    So you basic makes 1:1 traslating of your site, so the only thing that change is the content langague.

    Hope this explained it, if not don´t hesitate to ask again.

    /Dennis

  • Azamat Ismagulov 10 posts 30 karma points
    Jul 09, 2014 @ 07:45
    Azamat Ismagulov
    0

    Hi Dennis,

    I'm moving to finalise site with multilingual support.

    1. The English ver is available on this address: www.domainname.com. And the Russian is available on www.mydomain.com/ru. Is it possible to make www.mydomain.com/ru - site which will open by default?

    2. I've got logo and few dictionary elements - whether contain links to the pages. And for instance if you are on russian ver site, and clicking to the logo - it'll move you into the eng version Home page, but of course should move you into the russian ver Home page (the same for dictionary elements).

    3. And I'm still having trouble with my navigation, I have following Razor macros:

    @if (Model.Children.Where("Visible").Any())
    {        
    foreach (var childPage in Model.Children.Where("Visible"))
    {
    <li>
    <a href="@childPage.Url">@childPage.Name</a>
    </li>
    }
    }

    Which works fine expect, when you are on the sub page for instance www.mydomain.com/ru/news - It's showing only the Home page link in navigation menu.

    Probably there is should be additional statement.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 10, 2014 @ 18:49
    Dennis Aaen
    0

    Hi Azamat,

    Sorry for the late answer,

    I will try to answer your questions the best I can.

    1. Regarding your first question, I have not a exact an answer, if it is possible. Maybe you should try to create a separate topic on this subject. Then maybe someone can help you how to do it, if it´s possible.
    2. You should be able to solve your issue with you links, by setting the useDomainPrefixes to true. You can find the setting in /config/umbracoSettings.config, or try to see this blogpost http://blog.globalizationpartners.com/umbraco-multi-language.aspx
    3. If I understand you correcly, you have some problems getting a main menu to work. With this code you should be able to get level 1 menu items out.

    @inherits umbraco.MacroEngines.DynamicNodeContext
        @{
            var root = Model.AncestorOrSelf(1);
        }
       
        <ul>
            @foreach (var page in root.Children.Where("Visible")){
                <li class="@page.IsAncestorOrSelf(Model, "current", "")">
                    <a href="@page.NiceUrl">@page.Name</a>
                </li>
            }
        </ul>

    If you dont´t know it yet, you can find some good starter code snippets when you creates new razor files you can choose a template, there are code examples for breadcrumb, navigation List child pages from currentpage. You should definitely consider use partial view macros instead of the dynamic node razor. The dynamic node razor is the legacy razor and will be deprecated, and it is not so hard to convert the old legacy the dynamic node razor to partial view macros.

    Currentpage in the old legacy the dynamic node razor @Model, in partial view macros it is @CurrentPage.

    You can find the documentation for convert old legacy the dynamic node razor to partial view macros http://our.umbraco.org/documentation/Reference/Templating/Macros/Partial-View-Macros/ Look at the bottom of the page, to find the documentation.

    Hope my answers is helpful,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft