Using sortBy with special language specific characters

Hi, I am trying to create a Pages section in the panel sorted by “sortBy”.

Somehow I do not get this to work with German umlauts: “Br” is always appearing before “Bä”, while, normally in German, “Bä” should appear directly after “Ba”.

I read the reference, in particular #10 in

So I set the locale in config.php like this
'locale' => 'de_DE.UTF-8'
and in the blueprint I have
sortBy: title asc SORT_LOCALE_STRING

Am I missing something? I am thankful for any help here!

Hm, the only way I could get it to work was by setting the locale in the index.php and only using the ISO format:

setlocale(LC_ALL, ['de_DE.ISO8859-1']);


Thank you for the quick answer. This is probably working.

However, I just realized that, in my case, it doesn’t. Probably because I am using the pagesdisplay-Plugin:

There, in readme, it says: “you won’t be able to sort the list”.

So might that be the reason why sortBy locale isn’t working here?
My site.yml goes like this:

    headline: people
    type: pagesdisplay
    text: " {{ page.lastname }}"
    query: site.grandchildren.filterBy('my-radio-options', 'people')
    sortBy: lastname asc SORT_LOCALE_STRING

I think the note in the plugin’s readme just means that the plugin doesn’t support manual sorting by the user (with drag & drop) as it’s just a pages display section.

From your issue description I’d guess your site is a single-language site, right? I debugged this and found a bug that made the API ignore the configured locale for single-language sites. This bug is fixed by this PR.

I can reproduce this as well, but this doesn’t seem like something we can solve in Kirby (we only use native PHP functions for the actual sorting). Looks like some combination of strange PHP behavior and macOS to me.

This is great - many thanks for your help & for developing such a fine CMS!

1 Like

You are welcome. :slight_smile:

BTW: The fix will be in the next release 3.3.0. If you need it earlier, you can manually make this change in your installation.