diff options
author | Marius Bakke <mbakke@fastmail.com> | 2019-05-25 00:25:15 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2019-05-25 00:25:15 +0200 |
commit | 57df83e07d4b5e78d9a54c1a88d05b4a9ed65714 (patch) | |
tree | 76684e63965e9ad6e37d9d45bc3159e6c9782cd0 /gnu/installer/locale.scm | |
parent | 43d9ed7792808638eabb43aa6133f1d6186c520b (diff) | |
parent | 136b7d81f0eb713783e9ea7cf7f260a2b6252dfd (diff) | |
download | patches-57df83e07d4b5e78d9a54c1a88d05b4a9ed65714.tar patches-57df83e07d4b5e78d9a54c1a88d05b4a9ed65714.tar.gz |
Merge branch 'staging' into core-updates
Diffstat (limited to 'gnu/installer/locale.scm')
-rw-r--r-- | gnu/installer/locale.scm | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/gnu/installer/locale.scm b/gnu/installer/locale.scm index 284062a6e7..2ee5eecd96 100644 --- a/gnu/installer/locale.scm +++ b/gnu/installer/locale.scm @@ -62,12 +62,13 @@ (define (locale-modifier assoc) (assoc-ref assoc 'modifier)) -(define (locale-string->locale string) - "Return the locale association list built from the parsing of STRING." +(define* (locale-string->locale string #:optional codeset) + "Return the locale association list built from the parsing of STRING and, +optionally, CODESET." (let ((matches (string-match locale-regexp string))) `((language . ,(match:substring matches 1)) (territory . ,(match:substring matches 3)) - (codeset . ,(match:substring matches 5)) + (codeset . ,(or codeset (match:substring matches 5))) (modifier . ,(match:substring matches 7))))) (define (normalize-codeset codeset) @@ -107,17 +108,12 @@ '()))))) (define (supported-locales->locales supported-locales) - "Parse the SUPPORTED-LOCALES file from the glibc and return the matching -list of LOCALE association lists." - (call-with-input-file supported-locales - (lambda (port) - (let ((lines (read-lines port))) - (map (lambda (line) - (match (string-split line #\ ) - ((locale-string codeset) - (let ((line-locale (locale-string->locale locale-string))) - (assoc-set! line-locale 'codeset codeset))))) - lines))))) + "Given SUPPORTED-LOCALES, a file produced by 'glibc-supported-locales', +return a list of locales where each locale is an alist." + (map (match-lambda + ((locale . codeset) + (locale-string->locale locale codeset))) + (call-with-input-file supported-locales read))) ;;; |