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 428 posts 2354 karma points MVP 3x 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 1867 posts 11859 karma points MVP 4x c-trib
    May 28, 2019 @ 09:02
    Kevin Jump
    101

    Hi Paul,

    that should be the dictionaryItem.ItemKey value

    Kevin

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

    Thanks Kevin, much appreciated.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies