summaryrefslogtreecommitdiff
path: root/gnu/build/locale.scm
diff options
context:
space:
mode:
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))))))