Copied to clipboard

Flag this post as spam?

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


  • MK 429 posts 905 karma points
    Oct 31, 2013 @ 10:30
    MK
    0

    Set the website language / domain via c#

    Hi there,

    Does anyone know how can I go about setting the language via code?

    Ive tried to change the values in the umbracoDomains table with no success.

    Regards,

    mkariti

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 31, 2013 @ 10:37
    Fuji Kusaka
    0

    What exactly do you want to do here ? You want to set the Language type or to dynamically display the language type ?

  • MK 429 posts 905 karma points
    Oct 31, 2013 @ 10:48
    MK
    0

    Hi Fuji,

    Many thanks for your quick reply.

    I just want to be able to let the user set the website language via radio button.

    The user doesnt want to open nodes for each language and as its an intranet website there is no need for it.

    Ive also tried to send the json request to the SaveLanguageAndDomains method but keep getting 500 errors.

    I guess before compiling the source code I thought I'll better ask. Im sure there is an easy way or Ive just missed something.

    Cheers

    mkariti

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 31, 2013 @ 11:01
    Fuji Kusaka
    0

    Am also working on an Intranet System where i have 12 different countries. What i did on mine is only allow the Admin to attribute the Country to each of his User so as to restrict certain section or any other information prior to their country.

    But doing so how will you take restrict content if you a particular user doesnt have access to it ?

  • MK 429 posts 905 karma points
    Oct 31, 2013 @ 11:11
    MK
    0

    Im more after setting the language via the front end. None of my users (in my case member) have access to the back end.

    Only memer with the Admin role ca access the setting area (also found on the front end) and change the language for the current website.

     

  • Rich Green 2246 posts 4008 karma points
    Oct 31, 2013 @ 12:21
    Rich Green
    0

    You could just update the db table directly (umbracoDomains I believe)

    However you need to clear come cache after changing the table.

  • MK 429 posts 905 karma points
    Oct 31, 2013 @ 13:03
    MK
    0

    Hi Rich,

    Ive tried changing the umbracoDomains table and clear the cache using the following with no success:

    umbraco.library.RePublishNodesDotNet(1060);

    umbraco.library.RefreshContent();

    umbraco.library.RePublishNodes(1060);

    It seems as if only change in the web.config does the trick.

    Any ideas?

    Cheers

    mkariti

     

  • Rich Green 2246 posts 4008 karma points
    Oct 31, 2013 @ 13:12
    Rich Green
    0

    Hmm, don't know.

    It must be possible as it works via the UI, do you have the core source code to look at?

  • MK 429 posts 905 karma points
    Oct 31, 2013 @ 21:56
    MK
    0

    ok so I’ve managed to solve it by sending my json to the same method found in:

    '/umbraco/Api/DomainsApi/SaveLanguageAndDomains'

    Regards,

    mkariti

     

     

  • Jeffrey Weinstein 67 posts 313 karma points
    Nov 02, 2018 @ 07:07
    Jeffrey Weinstein
    0

    Hello, when I'm trying to add a new domain on my live website I get the exception

    https://pastebin.com/raw/QBf0T12T

    When I create vanilla Umbraco installation it works fine. Not sure what's wrong.

    Anyone facing the same issue?

Please Sign in or register to post replies

Write your reply to:

Draft