agentejo / cockpit

Add content management functionality to any site - plug & play / headless / api-first CMS
http://getcockpit.com
MIT License
5.4k stars 524 forks source link

Wrong sorting: list of languages #1497

Open Der-K-2000 opened 2 years ago

Der-K-2000 commented 2 years ago

In the list at the sidebar the list is sorted by the key, not the value. An example list from the config.php:


'languages' => [
    'danish' => 'Dänisch',
    'german' => 'Deutsch'
    'dutch' => 'Niederländisch',
]

Output will be

1. Dänisch
2. Niederländisch
3. Deutsch

...but it should be

1. Dänisch
2. Deutsch
3. Niederländisch

So the bug is: It's ordered by the array-key, not the value, which it should. And that's confusing, especially for newbies, who are only editing the text-fields.

Der-K-2000 commented 2 years ago

I was wrong. Excuse me. There is actually no sorting. Neither by key nor by value. It depends on the list you've add in the config.php. Nevertheless it would be good to sort by the values.

takumade commented 2 years ago

Please close this

Der-K-2000 commented 2 years ago

Please close this

Why? It's still not sorted.

mountainash commented 2 years ago

... but it is sorted... by the top-down line order (you said this yourself @SebastianBerlin).

Line order sorting also gives the Dev much more flexibility than a forced A->Z sort. Sorting by alphabetical would also override to all existing sites which have already set their preferred ordering.

Der-K-2000 commented 2 years ago

Well, no.

  1. There is no "flexibility" if you use multiple languages (for the admin-dashboard). In every language there has to be a different sorting and you can NOT fix that in any way.

It's a failure by construction, at least not well-wrought – and that function is necessary.

  1. Of course, there should be an option to choose, what you want, and to prevent problems with existing configs: Manual by config-file AND logical sorting by the value.