Copied to clipboard

Flag this post as spam?

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

  • Paul Seal 405 posts 2214 karma points MVP 3x c-trib
    May 27, 2019 @ 18:54
    Paul Seal

    How to get the name or alias of a dictionary item using the localization service

    I am working in Umbraco v8. I'm using the localization service.

    I can get a dictionary item by id, and I can get the value of the item by the language id.

    var dictionaryItem = _localizationService.GetDictionaryItemById(apiInstruction.NodeId);
    var defaultTranslationValue = dictionaryItem.Translations.FirstOrDefault(x => x.Id == defaultLanguage.Value);

    When there is no translation for the default language, I want to fall back to using the name of the dictionary item.

    So my question to you is, how do I access the name or alias of the dictionary item?

    image to show the where the name is in the dictionary item



  • Kevin Jump 1734 posts 11135 karma points MVP 4x c-trib
    May 28, 2019 @ 09:02
    Kevin Jump

    Hi Paul,

    that should be the dictionaryItem.ItemKey value


  • Paul Seal 405 posts 2214 karma points MVP 3x c-trib
    May 28, 2019 @ 10:22
    Paul Seal

    Thanks Kevin, much appreciated.

Please Sign in or register to post replies

Write your reply to: