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.
This commit is contained in:
Ludovic Courtès 2016-04-20 23:16:47 +02:00
parent f954c9b5da
commit 38f50f49f3
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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)))