Copied to clipboard

Flag this post as spam?

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


  • Eran 292 posts 436 karma points
    Dec 31, 2010 @ 15:49
    Eran
    0

    add overload to umbraco.library.GetDictionaryItem

    Hi,

    i tried to load dictionary value from asmx webservice class that i'm using.

    the webservice using dictionary items, but the problem is that is always get only english values and not the current culture that defined for the hostname.

    fot example, i call the function from the webservice like this:

    umbraco.library.GetDictionaryItem("DictionaryKey");

    when i open the source of the function GetDictionaryItem i see  that ifit calls:

    System.Threading.Thread.CurrentThread.CurrentUICulture.Name

    i think that although "CurrentUICulture" is not always the current culture that defined to the current hostname, and that makes all the problems.

    i think maybe it will be good idea also to add overload function that will pass it also culture id:

    umbraco.library.GetDictionaryItem("DictionaryKey", cultureID);

    if you have another idea how to solve this problem i would like to hear. if not, i think that adding an overload will be the best to solve that.

    Thanks,

    Eran.

     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jan 01, 2011 @ 05:45
    Lee Kelleher
    0

    Hi Eran,

    Just replied to your other forum post about the CurrentUICulture question.  It should be set to the culture selected for your language/hostname.

    Having an overload for the GetDictionaryItem method might be useful, but I think you have a different problem with your install/set-up? (but not sure what exactly).

    In the meantime, if you need an overload - then you can roll your own XSLT extension for GetDictionaryItem?

    public static string GetDictionaryItem(string key, int cultureId)
    {
        return new Dictionary.DictionaryItem(key).Value(cultureId);
    }

    Cheers, Lee.

  • Eran 292 posts 436 karma points
    Jan 02, 2011 @ 14:39
    Eran
    0

    the topic is solved.

    please take a look at the other forum post that is related.
    never the less, i think its a good idea to add overload to this method..

    Thanks,

    Eran

Please Sign in or register to post replies

Write your reply to:

Draft