Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    May 09, 2011 @ 11:53
    dominik
    0

    get culture info

    Hello i found the following script to get the culture info from the browser properties

     

    public static CultureInfo ResolveCulture()
    {

    string[] languages = HttpContext.Current.Request.UserLanguages;

    if (languages == null || languages.Length == 0)
    return null;
    try
    {
    string language = languages[0].ToLowerInvariant().Trim();
    return CultureInfo.CreateSpecificCulture(language);
    }

    catch (ArgumentException)
    {
    return null;
    }
    }

    public static RegionInfo ResolveCountry()
    {
    CultureInfo culture = ResolveCulture();
    if (culture != null)

    return new RegionInfo(culture.LCID);
    return null;

    }

    If i try to use it in XSLT i get the following error:

    Extension function parameters or return values which have Clr type 'RegionInfo' are not supported.


    Can someone please help?

    I just want to get the language and use it in XSLT

     

     

  • Sean Sachen 31 posts 77 karma points
    Aug 11, 2011 @ 15:57
    Sean Sachen
    0

    I know this is late, but did you try placing this in the global.asax.cs and maybe setting a session?  I believe you have access to the session in XSLT via the umbraco library.  If I remember right, you could put this in the ApplicationBegin_Request method of the .asax.cs.  I'm kind of shooting from the hip here, but that's where I'd start.

    HTH.

    Sean

Please Sign in or register to post replies

Write your reply to:

Draft