x First time here? Check out the FAQ
  • Avatar709posts731karma

    get culture info

    dominik started this topic May 9, 2011 @ 11:53

    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

     

     


  • Avatar14posts34karma
    Comment with ID: 86049
    Sean Sachen posted this reply August 11, 2011 @ 03:57

    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 login or Sign up To post replies