[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/11: ui: Add 'current-message-language'.
From: |
guix-commits |
Subject: |
06/11: ui: Add 'current-message-language'. |
Date: |
Mon, 23 Sep 2019 05:08:33 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit a725504a3a2f855c6a618e9b4cd222df91901113
Author: Ludovic Courtès <address@hidden>
Date: Sun Sep 15 17:54:05 2019 +0200
ui: Add 'current-message-language'.
* guix/ui.scm (%default-message-language): New variable.
(current-message-language): New procedure.
---
guix/ui.scm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/guix/ui.scm b/guix/ui.scm
index 4be31db..069d542 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -121,6 +121,10 @@
roll-back*
switch-to-generation*
delete-generation*
+
+ %default-message-language
+ current-message-language
+
run-guix-command
run-guix
guix-main))
@@ -428,6 +432,20 @@ exiting. ARGS is the list of arguments received by the
'throw' handler."
report them in a user-friendly way."
(call-with-unbound-variable-handling (lambda () exp ...)))
+(define %default-message-language
+ ;; Default language to use for messages.
+ (make-parameter "en"))
+
+(define (current-message-language)
+ "Return the language used for messages according to the current locale.
+Return %DEFAULT-MESSAGE-LANGUAGE if that information could not be obtained.
The
+result is an ISO-639-2 language code such as \"ar\", without the territory
+part."
+ (let ((locale (setlocale LC_MESSAGES)))
+ (match (string-index locale #\_)
+ (#f locale)
+ (index (string-take locale index)))))
+
(define (install-locale)
"Install the current locale settings."
(catch 'system-error
- branch master updated (acedaec -> 90ca791), guix-commits, 2019/09/23
- 01/11: pull: '--news' shows the list of channels added or removed., guix-commits, 2019/09/23
- 02/11: git: 'update-cached-checkout' avoids network access when unnecessary., guix-commits, 2019/09/23
- 06/11: ui: Add 'current-message-language'.,
guix-commits <=
- 03/11: git: Add 'commit-difference'., guix-commits, 2019/09/23
- 05/11: channels: Allow news entries to refer to a tag., guix-commits, 2019/09/23
- 04/11: channels: Add support for a news file., guix-commits, 2019/09/23
- 08/11: pull: '-l' displays channel news., guix-commits, 2019/09/23
- 10/11: Add '.guix-channel' file., guix-commits, 2019/09/23
- 07/11: pull: Display channel news., guix-commits, 2019/09/23
- 09/11: pull: Display news titles directly upon 'pull'., guix-commits, 2019/09/23
- 11/11: etc: Add channel news file., guix-commits, 2019/09/23