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 524 posts 2889 karma points MVP 6x c-trib
    May 27, 2019 @ 18:54
    Paul Seal
    0

    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

    Thanks

    Paul

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    May 28, 2019 @ 09:02
    Kevin Jump
    101

    Hi Paul,

    that should be the dictionaryItem.ItemKey value

    Kevin

  • Paul Seal 524 posts 2889 karma points MVP 6x c-trib
    May 28, 2019 @ 10:22
    Paul Seal
    0

    Thanks Kevin, much appreciated.

Please Sign in or register to post replies

Write your reply to:

Draft