question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v8: Get specific culture dictionary value

See original GitHub issue

At the moment UmbracoHelper have two overload methods to get value or an dictionary item.

GetDictionaryValue(string key)
GetDictionaryValue(string key, string altText)

https://github.com/umbraco/Umbraco-CMS/blob/853087a75044b814df458457dc9a1f778cc89749/src/Umbraco.Web/UmbracoHelper.cs#L174-L198

It would be great if we also could get a dictionary value of a specific culture and/or fallback to a culture, e.g. en.

Maybe something like this:

public string GetDictionaryValue(string key, string culture = null)
public string GetDictionaryValue(string key, string culture = null,  Fallback fallback = default)
public string GetDictionaryValue(string key, Fallback fallback = default)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
bjarnefcommented, Mar 21, 2021

@umbrabot still relevant I think this is relevant to get a dictionary value for a specific culture similar to what we can for property values.

0reactions
patrickdemooij9commented, Jul 13, 2021

I Will post the same here as I’ve posted in the PR:

While I am creating this PR, I am not 100% sure that this is the best way of doing it. I wanted to add default properties to the current GetDictionaryValue methods, but I then run into problems regarding overloads being the same. And I can’t quite add regular parameters as that’ll be a breaking change (quite a big one actually)… So, I am open to any feedback!

This PR only adds a new method for a different culture, nothing with a fallback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to get dictionary value for specific culture
Hi there,. How can I get the value of a DictionaryItem for a specific Culture ? There's a proposal by Bjarne to add...
Read more >
Get Dictionary Value action in the shortcut ...
Handling dictionaries using the Get Dictionary Value action in Shortcuts on iPhone or iPad. To get the value for a particular key in...
Read more >
How do you get a specific value from a dictionary that ...
You can retrieve the value from a dictionary key with dictionary['key'] mydict={'alone': '1', 'amazed' : '10', 'amazing' : '10', 'bad': '2', ...
Read more >
Object.ToString Method (System)
ToString method to provide support for format strings or culture-sensitive formatting. In this section: The default Object.ToString() method. Overriding the ...
Read more >
Resources in Education
cal Language Association of Southern Califor- nia , November 1 , 1969 , in Los Angeles , California Journal Cit - Forum ;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found