mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-19 14:07:01 +01:00
installer: Sort items with 'string-locale<?'.
That way "Österreich" comes before "Schweiz" in a German locale (or pretty much any sane locale.) * gnu/installer/newt/page.scm (run-listbox-selection-page)[sort-listbox-items]: Use 'string-locale<?' instead of 'string<=?'.
This commit is contained in:
parent
7cb7be17af
commit
14755829dc
1 changed files with 4 additions and 3 deletions
|
@ -21,6 +21,7 @@ (define-module (gnu installer newt page)
|
||||||
#:use-module (gnu installer utils)
|
#:use-module (gnu installer utils)
|
||||||
#:use-module (gnu installer newt utils)
|
#:use-module (gnu installer newt utils)
|
||||||
#:use-module (guix i18n)
|
#:use-module (guix i18n)
|
||||||
|
#:use-module (ice-9 i18n)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 receive)
|
#:use-module (ice-9 receive)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
|
@ -223,7 +224,7 @@ (define* (run-listbox-selection-page #:key
|
||||||
selected items will be returned.
|
selected items will be returned.
|
||||||
|
|
||||||
If SORT-LISTBOX-ITEMS? is set to #t, the listbox items are sorted using
|
If SORT-LISTBOX-ITEMS? is set to #t, the listbox items are sorted using
|
||||||
'string<=' procedure (after being converted to text).
|
'string-locale<?' procedure (after being converted to text).
|
||||||
|
|
||||||
If ALLOW-DELETE? is #t, the form will return if the <DELETE> key is pressed,
|
If ALLOW-DELETE? is #t, the form will return if the <DELETE> key is pressed,
|
||||||
otherwise nothing will happen.
|
otherwise nothing will happen.
|
||||||
|
@ -249,7 +250,7 @@ (define (fill-listbox listbox items)
|
||||||
items))
|
items))
|
||||||
|
|
||||||
(define (sort-listbox-items listbox-items)
|
(define (sort-listbox-items listbox-items)
|
||||||
"Return LISTBOX-ITEMS sorted using the 'string<=' procedure on the text
|
"Return LISTBOX-ITEMS sorted using the 'string-locale<?' procedure on the text
|
||||||
corresponding to each item in the list."
|
corresponding to each item in the list."
|
||||||
(let* ((items (map (lambda (item)
|
(let* ((items (map (lambda (item)
|
||||||
(cons item (listbox-item->text item)))
|
(cons item (listbox-item->text item)))
|
||||||
|
@ -258,7 +259,7 @@ (define (sort-listbox-items listbox-items)
|
||||||
(sort items (lambda (a b)
|
(sort items (lambda (a b)
|
||||||
(let ((text-a (cdr a))
|
(let ((text-a (cdr a))
|
||||||
(text-b (cdr b)))
|
(text-b (cdr b)))
|
||||||
(string<= text-a text-b))))))
|
(string-locale<? text-a text-b))))))
|
||||||
(map car sorted-items)))
|
(map car sorted-items)))
|
||||||
|
|
||||||
;; Store the last selected listbox item's key.
|
;; Store the last selected listbox item's key.
|
||||||
|
|
Loading…
Reference in a new issue