2

Since Sitecore 8.1 Update 2, one has been able to set the display order of languages in the Content Editor to follow the order of language items under /sitecore/system/Languages using the setting ContentEditor.SortLanguages. However, this has no impact on the order of languages from Database.GetLanguages(). Is there a way to apply this functionality to a front-end component, so that for example a language selector widget follows the language order of /sitecore/system/languages?

1 Answer 1

2

You can use LanguageComparer to apply this ordering:

var sortedLangauges = currentItem.Database.GetLanguages.OrderBy((x => x),new LanguageComparer(currentItem.Database));

This is what the ContextEditor.SortLangauges setting uses behind the scenes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.