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?

Thank you for reply! I think SORT_REGULAR is the way. But it is not working in blueprints (sortBy: title asc SORT_REGULAR) as written above. For your information, please check the natural order out.

What I expected. It is just simple:

  1. 노먼 포터
  2. 민구홍
  3. 밥 길
  4. 최성민

Without SORT_REGULAR (default, not working):

  1. 민구홍
  2. 밥 길
  3. 노먼 포터 (this must be the first!)
  4. 최성민

With SORT_REGULAR (working):

  1. 노먼 포터
  2. 민구홍
  3. 밥 길
  4. 최성민

With SORT_LOCALE_STRING (not working):

  1. 밥 길
  2. 노먼 포터
  3. 민구홍
  4. 최성민

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

Hmm… It’s weird. I’m testing on 3.3.5 and MAMP. It’s not working on mine. I will try to find another way as well. Thank you so much for your help!

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!