Korean sortBy issue

Hello, I have a small but big issue testing Kirby 3 to make a Korean small dictionary.

In Korean sortBy('title', 'asc') and sortBy('title', 'desc') is not working correctly. I had same issue using Kirby 2, though it solved now.

I looked through kirby/src/Toolkit/Collection.php#L906, but I don’t know why. Is there anyone who can help me?

Can you try with SORT_LOCALE_STRING flag on Kirby 3 like that?

sortBy('title', 'asc', SORT_LOCALE_STRING)

Thank you. It’s not working, but I found a way!

sortBy('title', 'asc', SORT_REGULAR)

But SORT_REGULAR is not working in the Panel and blueprints. I didn’t know that before. Now I just wonder why this basic function was not mounted.

Could you share an example list with actual and expected order to test please?

I see that it works properly on the panel without any additional settings. Which Kirby version do you use?

sortBy: title asc

FireShot Capture 053 - Mægazine - localhost

sortBy: title desc

FireShot Capture 054 - Mægazine - localhost

Really weird. Let’s ask to @texnixe have an idea about the issue?

Is the locale set?

For me, it was sorted correctly whether I set it or not.

For me it works if I set the locale and then sort by

sortBy: title asc SORT_LOCALE_STRING

SORT_NATURAL also works, adding nothing only works with the locale set.

Yes. But it was not sorted correctly whether I set it or not. Maybe it’s because of the PHP version? I’m using 7.3.8 on MAMP.

I just tested with MAMP as well with different PHP versions, not 7.3.8 though), and the result is the same. With the locale set, sorting works for me, no matter if I use a sort flag or not.

Edit: Somehow it doesn’t work if I set the locale to ko_KR.utf-8, hm :thinking, while just setting ko works.

I’m using PHP 7.3.14 either. Did you test with Kirby starterkit or plainkit?

I tested with both, and the result is the same. I need to test with another computer and OS!

ko works instead of ko_KR! :smile: But why? I don’t know… If I need to use Korean, I should set the locale?

I don’t know, this is weird.

Yes, that usually makes sense for any language, anyway, because it also affects dates, numbers etc. Or do you have a multi-language site?

Not now. But it could be. Before that I think I need to test more with another machine and OS. Thank you so much!

If you create languages, the locale is added to the language definitions in /site/languages/, anyway.

But we have to investigate, why the full locale doesn’t work.

Thank you. I will do that.

Yes, please!

I created an issue on GitHub:

For now, you can probably work with the “reduced” locale.

1 Like