kylebarrow / Sort.novaextension

Alphanumeric line sorting for Nova.app
0 stars 0 forks source link

Sort does not use the macOS sorting pattern from System Preferences, i.e. does not work for non-english alphabets. #1

Open ezbek opened 3 years ago

ezbek commented 3 years ago

When for instance using a non-English sort order, sort does not work as expected and does not honor the local alphabet so I would currently not consider the sort extension smarter than my spreadsheet's sort algorithm which at least manages to get basic sorting right ;)

(The bug verified with Swedish and German sort setting in the mac's System Preferences)

kylebarrow commented 3 years ago

It would be helpful to provide a short example of an unsorted list and expected sorted results to help debug this issue.

FYI, I use the localeCompare method to sort these lists and am not setting a locale override so the default locale should be used, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument

This method has numerous options that could tweak and improve results and I'd be happy to look into to some of them if you can provide the above example.

ezbek commented 3 years ago

Hi,

Thanks for your swift answer. I enclose three screenshots  - before, after and the required correct result.

As you can see in my examples I have English chosen for interface language but Swedish Std as sort method. Sort operations in other editors such as Coda, BBEdit, Sublime Text + any office application works fine with these settings.

Trivia 1: The Swedish language contains three additional characters (å, ä and ö) which in language terms is not 'a' and 'o' with an umlaut as the 'ä' and 'ö' in the German language but actual alphabetic characters. In Swedish you find them at the end the alphabet.

Trivia 2:If you wonder what words I picked for the example is the Swedish translations of the English words: äpple = apple, år = year, över = over. They don't sound at all like a or o which is why we usually find "nordic" spellings like Motörhead etc very amusing over here.

Sorting in Nova: There are currently three general sort extensions for Nova and only one works correctly as of today. The one named "Sort Lines" doesn't work at all with current Nova version. Yours only seem to sort English text and only the one by Chris DiLorenzo works as advertised.

I thought your intended smart sort of numbers was inventive. A suggestion for future features would be to be able to sort of different "columns" of (TAB/CSV/etc) delimited text.

As of today I use BBEdit's Sort Lines with a regular expression for such operations.  I think BBEdit's sort is the most complete sort function available in any of the editors I have used.

I'd love to see something similar as an extension to Nova.

Anyways, hope my information helps you to debug the code.

Cheers,

— Orc On 9 Feb 2021, 00:40 +0100, Kyle Barrow notifications@github.com, wrote:

It would be helpful to provide a short example of an unsorted list and expected sorted results to help debug this issue. FYI, I use the localeCompare method to sort these lists and am not setting an locale override so the default locale should be used, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument This method has numerous options that could tweak and improve results and I'd be happy to look into to some of them if you can provide the above example. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.