Copied to clipboard

Flag this post as spam?

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


  • Fredrik Esseen 594 posts 830 karma points
    Nov 04, 2010 @ 13:59
    Fredrik Esseen
    0

    How to get the language of current node

    Hi!

    I would like to retrieve the language that I have set on the top node of my multilingual site.

    I want to save the language to a table in the db that i have created.

    I cannot use the current language of the user because they can switch to a different part of the website that has a different language.

    I want to get this from my usercontrol. Is that posible?

    Ive tried to use the Domain class but as I understand it that is only if the langugae is set to just that node..?

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Nov 04, 2010 @ 14:30
    Tom Fulton
    1

    Haven't really tested, but something like this?

                Domain[] domains = umbraco.library.GetCurrentDomains(Node.GetCurrent().Id);
                if (domains != null)
                {
                    foreach (Domain d in domains)
                    {
                        langList += d.Language.CultureAlias;
                    }
                }

    If you are using multiple languages/domains on one parent node you might need to do some matching of the domain

  • Fredrik Esseen 594 posts 830 karma points
    Nov 04, 2010 @ 14:33
    Fredrik Esseen
    0

    Thx :)

    I just realized that i was totally wrong..

    You DO actually get the current domain namn from Domain. I thought that was specific if you had assigned a domain to just that node..

    Sorry..

  • 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