Our project has finally come to a point where we can add translations. I just cant seem to figure out how to actually work with languages in Umbraco 7. Ive added a language and a few dictionary items in the backend, but how do i select the givent language in my code?
Are there any helpers to get translations in the API? Like DictionaryHelper.Translate("Answers","da-DK"); ? Or similar? Is there a way to set the language, etc in the startup controller, and just always get that language from the dictionary?
Thanks in advance. Jonas.
First, you have to create your languages under Settings > Languages.
Next step is to set the language on each node, or just on a top node. So lets say your content tree looks like this:"
Then right click on "da" and select "Culture and Hostnames". Select "da-DK" for this node. All subnodes (and "da" node) will now have the danish language.
So now its simple to get dictionary items in razor and c# code. In razor:
@Umbraco.GetDictionaryValue("Answers")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With