Umbraco-CMS: Umbraco 9 GetDictionaryValue not working?
Which exact Umbraco version are you using? For example: 8.13.1 - don’t just write v8
9.0 RC2
Bug summary
hi - using the following code in a view:
var mydictionaryvalue = @Umbraco.GetDictionaryValue("My Key here");
It always returns an empty string.
The Language setup looks stock standard and the dictionary item does exist and has a value.
thanks
Specifics
No response
Steps to reproduce
- create dictionary with specified key
- add code from description to view or partial view
Expected result / actual result
expected results: GetDictionaryValue method returns value for key specified. actual results: empty string
This item has been added to our backlog AB#13859
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 28 (20 by maintainers)
After some more fiddling yesterday I finally found the magic combination to make it fail on my machine:
The last bit that I changed was the regional format, from
English (Denmark)toDanish (Denmark).Now when I switch to Danish as a culture on the node, I get no translation. When I put
@System.Globalization.CultureInfo.CurrentUICulturein the template, it results inen-US- which must be coming fromDefaultUILanguagesince I have not added anen-USlanguage in Umbraco so it should not even be available.To my knowledge, there is not changes to this part of Umbraco between v8 and v9
A quick test of upgrading a v8 site with 2 dictionary items nested under each other also works for me, but items give me the translation they contain.