Where is the order of languages in Publish Item
dialog defined?
And what would be the way to amend it i.e. make it the same order as languages under /sitecore/system/Languages
?
Couldn't find anything about the topic online 😔
You can't change the order without custom code.
When the Publish
form builds the language list, it first calls:
LanguageManager.GetLanguages(Context.ContentDatabase);
Then orders then using:
languages.OrderBy(l => l.GetDisplayName())
Unfortunately, .GetDisplayName()
does not get the display name of the item, but the display name of the CultureInfo
of the language code:
/// <summary>Gets the display name.</summary>
/// <param name="cultureInfo">The culture info.</param>
/// <returns>The display name.</returns>
public static string GetDisplayName(CultureInfo cultureInfo)
{
Sitecore.Diagnostics.Assert.ArgumentNotNull((object) cultureInfo, nameof (cultureInfo));
if ((cultureInfo.CultureTypes & CultureTypes.UserCustomCulture) != CultureTypes.UserCustomCulture)
return cultureInfo.EnglishName + " : " + cultureInfo.NativeName;
return "{0} : {1}".FormatWith((object) cultureInfo.Name, (object) cultureInfo.NativeName);
}
So the only way to change it would be to override the default Publish
dialog and create your own to order the languages differently.