summary refs log tree commit diff
path: root/gnu/build/locale.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-06-06 16:52:15 +0200
committerLudovic Courtès <ludo@gnu.org>2019-06-07 21:50:18 +0200
commit0e6cee21a48294b81a5e57e00602728fe7f7075f (patch)
tree610e05b29aff9eded92c53f647b17608504dd7e7 /gnu/build/locale.scm
parent15ec93a7832ae7dde747ccd9bb2bb2776be9f199 (diff)
downloadguix-0e6cee21a48294b81a5e57e00602728fe7f7075f.tar.gz
gnu: glibc-locales: Install symlinks using the normalized codeset.
Fixes <https://bugs.gnu.org/36076>.
Reported by Jack Hill <jackhill@jackhill.us>
and Giovanni Biscuolo <g@xelera.eu>

* gnu/build/locale.scm (locale->name+codeset): New file.
* gnu/packages/base.scm (make-glibc-locales): Add #:modules
and #:imported-modules.  Add a 'symlink-normalized-codesets' phase.
Diffstat (limited to 'gnu/build/locale.scm')
-rw-r--r--gnu/build/locale.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/gnu/build/locale.scm b/gnu/build/locale.scm
index c75a2e9dc5..412759a320 100644
--- a/gnu/build/locale.scm
+++ b/gnu/build/locale.scm
@@ -24,6 +24,7 @@
   #:use-module (ice-9 regex)
   #:export (build-locale
             normalize-codeset
+            locale->name+codeset
             read-supported-locales))
 
 (define locale-rx
@@ -84,3 +85,11 @@ discarded."
   (invoke localedef "--no-archive" "--prefix" directory
           "-i" locale "-f" codeset
           (string-append directory "/" name)))
+
+(define (locale->name+codeset locale)
+  "Split a locale name such as \"aa_ER@saaho.UTF-8\" into two values: the
+language/territory/modifier part, and the codeset."
+  (match (string-rindex locale #\.)
+    (#f  (values locale #f))
+    (dot (values (string-take locale dot)
+                 (string-drop locale (+ dot 1))))))