Umbraco: Get Dictionary Item In umbraco by c#.

How to get dictionary item value in umbraco. Below is code which will return translated item correspond to item in Dictionary based on language.

        public static string GetDictionaryItem(string item, int lang)
        {
            string translation;
            try
            {
                translation = new umbraco.cms.businesslogic.Dictionary.DictionaryItem(item).Value(lang);
            }
            catch (Exception)
            {
                translation = string.Empty;
            }
            // need to check for empty string to show keyname when item not translated 
            if (string.IsNullOrEmpty(translation))
                translation = item;
            return translation;
        }

Another Umbraco Article

Page Keyword: How to get dictionary item in umbraco. Umbraco Dictionary item.

Advertisements

2 thoughts on “Umbraco: Get Dictionary Item In umbraco by c#.

  1. Pingback: Create your first Rss Feed Burner in umbraco | [Code Destination]

  2. Pingback: Install umbraco manually. | [Code Destination]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s