Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
So, I'm developing a multi-language website on Umbraco 8 and I'm really in need of information on how to implement language support in Umbraco 8. For example I'm using this piece of code to get my main menu:
Model.Root().Children.Where(x => x.IsVisible()).ToArray();
Problem is when I'm navigating from my Danish website to the German one (which doesn't have any pages published under the home-page) I'm still getting those pages from the Danish version - except only the node and not with the danish nodal information in it. What the...
Do I need to use another method for this support?
I think you have to change your line of code to something like this:
var currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
Model.Root().Children.Where(x => x.IsVisible() && x.Cultures.ContainsKey(currentCulture)).ToArray();
The current page Model contains values for the intended language automatically, according to the current culture, set by the culture and hostnames settings.
When you get the children of the current page model, you will get exactly what you are asking, the children of the current page, even when that child doesn't have property values for the current culture.
Hi Tony, maybe you could take a look at this article:
Great - thanks Tom. Unfortunately, that article didn't exist when I originally posted the question but thanks for the find ;-) I did manage to solve the problem back then.
No problem. Good to hear you've already solved the problem!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted