Sort culture or language in specific order

Katha I asked on January 11, 2021 14:40


is there a way to sort my website culture in a specific order? My Language Changer on the website (created with a basic repeater and a LanguageDataSource web part) is currently displaying the website langugaes/cultures in this order: 1. chinese 2. german 3. japanese 4. english

But instead I need the following order: 1. english 2. german 3. chinese 4. japanese

How can change the order?

Recent Answers

Juraj Ondrus answered on January 12, 2021 07:45

I am afraid but the language data source web part/control does not have the property for sorting/ordering. The cultures are sorted alphabetically by default. IF you want to change the ordering, you will need to create custom data source web part and get the cultures from the DB and sort them as you want. You can get the URLs using code like this (from the default language selector):

if (Node != null)  
                string url = URLHelper.RemoveQuery(RequestContext.CurrentURL);  
                documentCultureURLs = DocumentURLProvider.GetDocumentCultureUrls(Node, url, ExcludedCultureCode, UrlOptions);  
return documentCultureURLs;
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.