Copied to clipboard

Flag this post as spam?

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


  • Jesper Johansen 8 posts 48 karma points
    Jan 23, 2014 @ 14:52
    Jesper Johansen
    0

    Dictionary - select SPECIFIC language

    Hi

    This may sound as a bit of a strange request. But it is possible to directly select a specific language in the dictionary, overriding any top-level definitions?

    Something like @Dictionary.Home.English or @Dictionary["Home"].English

    It is for bulk emails - I use Umbraco to render the html. The user have a list of recipients and sets language for each list. But when the html renders, it always use the user-setting...

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 23, 2014 @ 17:48
    Fuji Kusaka
    100

    Hi Jesper,

    You can just make use of @umbraco.library.GetDictionayItem("Home") after setting the language type. 

    Or if am not mistaken you can also try using 

     

    @using System.Globalization;
    @{

    Domain[] domains = umbraco.library.GetCurrentDomains(@Model.Id);
     var currentLanguage = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.ToLower();

    if (currentLanguage.Contains(en)) {
    @:Some text
      }

     

     

     

    Not sure what you aare looking to achive but hope this helps

  • Jesper Johansen 8 posts 48 karma points
    Jan 24, 2014 @ 16:56
    Jesper Johansen
    0

    Hi again

    Yes, I ended up doing something similar:

    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture ("en-US");
    Thread.CurrentThread.CurrentUICulture=new CultureInfo("en-US");
    

    After this I could just use the dictionary as usual, although my overall culture-setting is different.

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 25, 2014 @ 10:29
    Fuji Kusaka
    0

    Great  but perhaps you can also remove US from the Culture Info and make use of only 2 characters instead

    TwoLetterISOLanguageName.ToLower();

    //Fuji

Please Sign in or register to post replies

Write your reply to:

Draft