[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/05: substitute: Install the client's locale.
From: |
Ludovic Courtès |
Subject: |
04/05: substitute: Install the client's locale. |
Date: |
Wed, 20 Apr 2016 21:29:52 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit 38f50f49f395fcda6ab3395ebaa312f8ee24d80d
Author: Ludovic Courtès <address@hidden>
Date: Wed Apr 20 23:16:47 2016 +0200
substitute: Install the client's locale.
* guix/store.scm (set-build-options): Add #:locale parameter and honor
it.
* guix/scripts/substitute.scm (guix-substitute): Install the client's
locale.
---
guix/scripts/substitute.scm | 7 +++++++
guix/store.scm | 8 +++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index e0a694a..fa1dd09 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -1000,6 +1000,13 @@ default value."
(newline)
(force-output (current-output-port))
+ ;; Attempt to install the client's locale, mostly so that messages are
+ ;; suitably translated.
+ (match (or (find-daemon-option "untrusted-locale")
+ (find-daemon-option "locale"))
+ (#f #f)
+ (locale (false-if-exception (setlocale LC_ALL locale))))
+
(with-networking
(with-error-handling ; for signature errors
(match args
diff --git a/guix/store.scm b/guix/store.scm
index af311a0..8d1099d 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -534,7 +534,10 @@ encoding conversion errors."
(substitute-urls #f)
;; Number of columns in the client's terminal.
- (terminal-columns (terminal-columns)))
+ (terminal-columns (terminal-columns))
+
+ ;; Locale of the client.
+ (locale (false-if-exception (setlocale LC_ALL))))
;; Must be called after `open-connection'.
(define socket
@@ -573,6 +576,9 @@ encoding conversion errors."
,@(if terminal-columns
`(("terminal-columns"
. ,(number->string terminal-columns)))
+ '())
+ ,@(if locale
+ `(("locale" . ,locale))
'()))))
(send (string-pairs pairs))))
(let loop ((done? (process-stderr server)))