theme: apply collation when sorting themes (#77217)
gitea/hobo/pipeline/head This commit looks good
Details
gitea/hobo/pipeline/head This commit looks good
Details
It's not perfect but enough to have a usable sorting order.
This commit is contained in:
parent
f805a4ab31
commit
cc15770e78
|
@ -16,6 +16,7 @@
|
|||
|
||||
import json
|
||||
import os
|
||||
import unicodedata
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
@ -38,7 +39,12 @@ def get_themes():
|
|||
if not 'module' in theme:
|
||||
theme['module'] = dirname
|
||||
themes.append(theme)
|
||||
themes.sort(key=lambda x: x.get('label'))
|
||||
|
||||
def key_function(theme):
|
||||
label = theme.get('label')
|
||||
return unicodedata.normalize('NFKD', label.upper()).encode('ascii', 'ignore').decode()
|
||||
|
||||
themes.sort(key=key_function)
|
||||
return themes
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue