Isn't this a bug?: List of Locales/Languages is not sorted

After enabling Internationalization, the locale/language order gets messed up by the realm configuration. Isn’t this a bug?

This is what it looks like:

I think it corresponds to the order in the realm configuration (I’m a new user and can only have one image. but there is what it looks like in the realm configuration - link to imgur: https://i.imgur.com/rMaIPSL.png) But I don’t seem to be able to modify that order.

Can I sort the locales/languages somehow?

To reproduce:

  • Create a new realm
  • Under “Realm Settings”, “Themes”, turn “Internationalization Enabled” On.
  • Notice that the list is sorted
  • Click “Save”
  • Notice that the list is now no longer sorted

Should I just file a bug and be done with it or is there something I can do?

Why do you consider this as a bug? Does this prevent Keycloak from working? Or is it just “not nice to view”?

I don’t know any possibility to sort the list. And if there is no sorting built in the source code and the list is just retrieved from the database w/o sorting, the order may vary.

Of course you can file an issue, but I doubt that the core team will “fix” this, as this is not a bug and they have other things to do. If you want to have this changed, you should also provide a PR for this.

Maybe you can use sort or sort_by in FreeMarker Template to sort list.
Something like this:

<#list locale.supported?sort_by("label") as l>
  <li class="kc-dropdown-item"><a href="${l.url}">${l.label}</a></li>
</#list>