Alphabetical sort order

In Hugo 0.57, alphabetical sort order is supported. How do we choose which alphabetical order to choose? I mean in international/multi-lingual contexts how do I choose the sort order of Swiss German, vs. Germany German?

1 Like

How do the Swiss sort different?

When I read the anouncement and thought about sorting in MySQL where you have to define a encoding style so either Ä is sorted right behind A and not behind Z as it would be in “normal”. I am afraid that will be what is done in Go, just after ASCII-code order.

I’ll have an eye on this :wink: interesting topic.

So, @regis raised an issue asking about this. I asked him some of the questions above, but we decided to start with something simple that would greatly improve the current situation: Sorting based on Unicode case-folding. Which isn’t as flexible/powerful as the collation features you find in MySQL etc., but is for most people certainly (even the Swiss I would presume) thousand times better than what we had.

Note that we’re in general missing a lot in this department, but I have been waiting for this to mature in the Go libraries so we/I don’t have to invent the wheel, so to speak. Go is a great platform in many ways, but in some areas it is still … young.

3 Likes

To clarify some points, I am referring to CLDR based coalition orders.Which would be one type of sort order for a language, but is based on the language’s code and the data in the CLDR package. CLDR is a seperate data set from the Unicode character set, but is also made available via the Unicode Consortium website. See: http://userguide.icu-project.org/collation

Poking my head around this issue I see that there is a GoLang Module for using CLDR language taged data. see: https://godoc.org/golang.org/x/text/collate

I understand @bep 's hesitation to reinvent what should be written and provided via GoLang. To add some specification for what should (IMO) be accessible to Hugo users would be to sort some range (like a set of taxonomies, or a series of posts) by a defined language collation order per a given CLDR tag. This would be an attribute of a specified sorting process and would not necessarily be the same as the language specified in the params of the hugo website… something like the following hierarchy.

Sort by the CLDR specification for a given language tag on the unique sorting operation as specified {{else if}} sort by the language specified by the default website language tag {{ else }} Sort by the language of the rendering computer

1 Like

I ran into the same problem. In my case I’m using Scratch.GetSortedMapValues to sort a Glossary in multiple languages: Sort Glossary by tdelmas · Pull Request #1195 · letsencrypt/website · GitHub (The translations are in the same order as English, so they must be reordered).

A GetSortedMapValuesLocale with the local as additional argument would have been really useful!

This topic was automatically closed after 6 days. New replies are no longer allowed.