Copied to clipboard

Flag this post as spam?

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


  • René 327 posts 851 karma points
    Mar 24, 2015 @ 14:27
    René
    0

    Hi

    Thanks for a great project, Vorto, it looks great.. 

    Unbraco version 7.2

    One question.. I can not see how to change the language. 

    I need to have a dropdown list to change the language.
    I have been searching for som documentation for this.

    Site structure:

    Main page

    Hostnames set on the main page

    UK

    DE

    US

    Is there any who have a hint on how this is managed. Or maybe i´m missing something :-)

    /René 

  • Dennis Aaen 4417 posts 17825 karma points admin hq c-trib
    Mar 24, 2015 @ 14:34
    Dennis Aaen
    0

    Hi René,

    Try to see this http://uhangout.co.uk/video/fC-Xhj1HnnU epsiode of uHangout, where the creator of the package is explains how the package works, and to configure it.

    Hope this helps,

    /Dennis 

  • René 327 posts 851 karma points
    Jul 15, 2015 @ 17:36
    René
    1

    HI

    I have made a very simple language switcher, just for testing.

    enter image description here

    Damn editor Here is an image of the code:

    enter image description here

    This is from the master:

    @{
    Layout = null;
    var root = Model.Content.AncestorOrSelf(2).Children;
    var domains = Domain.GetDomains();
    var arrDomains = domains as Domain[] ?? domains.ToArray();}
    

    @Navigation@

    @Language switch@

    @if (arrDomains.Any()) { foreach (var domain in arrDomains) { var currentPage = Model.Content.Url.TrimStart("/" + Culture); var url = domain.Name + currentPage; @domain.Language.FriendlyName } }

    @RenderBody()

    The result:

    The result

  • Denford 91 posts 186 karma points
    Jul 20, 2015 @ 16:01
    Denford
    1

    Not cure if you got any answer for this yet, but for anyone who need this just been building my own logic for it so;

    1) dropdown list with all languages using umbraco.cms.businesslogic.language.Language.GetAllAsList()

    2) set a cookie with the language when this changes

    3) get the language from the cookie and get the value from the vorto call with the extra overlaod of the language e.g. Model.Content.GetVortoValue("yourVortoAlias", "cookieLanguage")

    just got this last step in my own custom class so that i cna set any defaults if that language has got no values.

  • Amir Khan 929 posts 1835 karma points
    Aug 31, 2015 @ 17:06
    Amir Khan
    0

    Is there a complete example of this somewhere? I can't seem to figure out how to build a simple language picker for Vorto...

    Thanks,

    Amir

  • Amir Khan 929 posts 1835 karma points
    Sep 11, 2015 @ 19:24
    Amir Khan
    0

    In case anyone is looking:

    <ul>
                    @foreach(var lang in umbraco.cms.businesslogic.language.Language.GetAllAsList())
                    {
                        var currentCulture = @System.Globalization.CultureInfo.CurrentCulture.Name;
                        var currentPage = Model.Content.Url.TrimStart("/" + @currentCulture);
                        var url = "/" + @lang.CultureAlias + currentPage;
    
                        <li><a href="@url">@url, @lang.CultureAlias, @lang.FriendlyName</a></li>
                    }
                </ul>
    
  • René 327 posts 851 karma points
    Jun 15, 2017 @ 21:14
    René
    0

    HI If anyone can use this.

     @foreach(var lang in ApplicationContext.Current.Services.LocalizationService.GetAllLanguages().ToList())
    {
        var currentCulture = System.Globalization.CultureInfo.CurrentCulture.Name;
        var currentPage = Model.Content.Url.TrimStart("/" + @currentCulture);
        var url = "/" + lang.CultureInfo.TwoLetterISOLanguageName + currentPage;
    
        <li><a href="@url">@url, @lang.CultureName, @lang.CultureInfo.DisplayName</a></li>
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft