Issue with sort filters and the swedish letters å/ä/ö

Hi!
Longtime TW user and group/forum lurker here…

One thing that has been bugging me over the years, as a swede, is that I never found an easy way to sort titles alphabetically using the sort filters, with å/ä/ö handled as separate letters, as they are in swedish.

I do not know too much about javascript, but have dug into the shadow tiddler $:/core/modules/wiki.js and the sortTiddlers function, adding “sv” as a second, locale, parameter to its localeCompare instances. With the TW 5.3.1 that I’m working with, it solves my sorting issues, and I have not yet encountered any problems.

However, I still wonder if an easier workaround exists, and if there are potential problems with the way I handled it?

Thanks in advance.
//Anders

Welcome to the forum!

That’s an option. But it’s hardcoded now. If your content is Swedish only it’s OK. If you use mixed languages, you will see the same problem for the other languages now.


According to MDN (Mozilla Dev Network) localeCompare() docs there is no obvious info about the defaults. The docs only talks about “implementation defaults”, which most likely is English.

At the moment there is no easy way to define a language specific parameter for sort functions.

I think it would be worth to make more browser languages specific sort options available to the user.

I do not think there are any problems, other than for mixed content that I did mention in the other post

Thanks!

That my solution is hardcoded is admittedly less than elegant; a more ”user-friendly” way of switching between locales would indeed be lovely (if I had more know-how I would gladly offer to produce a plugin for it).

For me personally, however, hardcoding the locale will not likely be a problem. When using TW I write in english or swedish; the difference in alphabet is that swedish add the letters å/ä/ö at the end, after z, so I imagine that the sorting of titles in english should not be affected at all…