Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi!
I am implementing a shop with swedish as the main locale. Now I have learned that the natural sorting in swedish puts Umlauts at the end, after "z".
Question: is there a way to use a function like natsort in conjunction with the selected Locale?
Desired result:
a = [ "o", "ö", "z", "ä", "å", "a", "á", "æ"]
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
> 'de_DE.UTF-8'
natsorted(a, alg=ns.REAL | ns.LOCALE | ns.IGNORECASE)
> ['a', 'á', 'å', 'ä', 'æ', 'o', 'ö', 'z']
locale.setlocale(locale.LC_ALL, 'sv_SE.UTF-8')
> 'sv_SE.UTF-8'
natsorted(a, alg=ns.REAL | ns.LOCALE | ns.IGNORECASE)
> ['a', 'á', 'o', 'z', 'å', 'ä', 'æ', 'ö']
Thanks!
Has this been addressed in the meantime? In the meantime the shop owner had renamed the products so that I can not verify my assumption right now. However, in the menu it does say Alfabetiskt, A–Ö -- as I would expect it with locale aware Alphasort applied.
If it has been addressed by now, this post is obsolete obviously
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025