[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
08/10: installer: Display language and territory names natively.
From: |
guix-commits |
Subject: |
08/10: installer: Display language and territory names natively. |
Date: |
Wed, 17 Apr 2019 05:54:09 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 7837a57241775fed221c9e03700af73263e222ed
Author: Ludovic Courtès <address@hidden>
Date: Wed Apr 17 11:07:21 2019 +0200
installer: Display language and territory names natively.
* gnu/installer.scm (installer-program): Add calls to 'bindtextdomain'.
* gnu/installer/newt/locale.scm (run-locale-page) <language, territory>:
Add calls to 'gettext'.
---
gnu/installer.scm | 10 ++++++++++
gnu/installer/newt/locale.scm | 18 +++++++++++++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/gnu/installer.scm b/gnu/installer.scm
index 6a7a556..5baead8 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -343,6 +343,16 @@ selected keymap."
;; Add some binaries used by the installers to PATH.
#$set-installer-path
+ ;; Arrange for language and territory name translations to be
+ ;; available. We need them at run time, not just compile time,
+ ;; because some territories have several corresponding languages
+ ;; (e.g., "French" is always displayed as "français", but
+ ;; "Belgium" could be translated to Dutch, French, or German.)
+ (bindtextdomain "iso_639-3" ;languages
+ #+(file-append iso-codes "/share/locale"))
+ (bindtextdomain "iso_3166-1" ;territories
+ #+(file-append iso-codes "/share/locale"))
+
(let* ((current-installer newt-installer)
(steps (#$steps current-installer)))
((installer-init current-installer))
diff --git a/gnu/installer/newt/locale.scm b/gnu/installer/newt/locale.scm
index 01bcf76..7108e29 100644
--- a/gnu/installer/newt/locale.scm
+++ b/gnu/installer/newt/locale.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <address@hidden>
+;;; Copyright © 2019 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -161,7 +162,13 @@ glibc locale string and return it."
(run-language-page
(sort-languages
(delete-duplicates (map locale-language supported-locales)))
- (cut language-code->language-name iso639-languages <>)))))
+ (lambda (language)
+ (let ((english (language-code->language-name iso639-languages
+ language)))
+ (setenv "LANGUAGE" language)
+ (let ((native (gettext english "iso_639-3")))
+ (unsetenv "LANGUAGE")
+ native)))))))
(installer-step
(id 'territory)
(compute
@@ -175,10 +182,11 @@ glibc locale string and return it."
;; supported by the previously selected language.
(run-territory-page
(delete-duplicates (map locale-territory locales))
- (lambda (territory-code)
- (if territory-code
- (territory-code->territory-name iso3166-territories
- territory-code)
+ (lambda (territory)
+ (if territory
+ (let ((english (territory-code->territory-name
+ iso3166-territories territory)))
+ (gettext english "iso_3166-1"))
(G_ "No location"))))))))
(installer-step
(id 'codeset)
- branch master updated (0682f08 -> 1475582), guix-commits, 2019/04/17
- 01/10: gnu: awesome: Update home page., guix-commits, 2019/04/17
- 02/10: self: Remove unused variable., guix-commits, 2019/04/17
- 04/10: gnu: guix: Don't pass '--with-libgcrypt-prefix'., guix-commits, 2019/04/17
- 06/10: gnu: guix: Update to b8b1e4d., guix-commits, 2019/04/17
- 07/10: installer: Change language as soon as it has been chosen., guix-commits, 2019/04/17
- 09/10: installer: Look up timezone name translations in "iso_3166-1"., guix-commits, 2019/04/17
- 08/10: installer: Display language and territory names natively.,
guix-commits <=
- 10/10: installer: Sort items with 'string-locale<?'., guix-commits, 2019/04/17
- 03/10: build: No longer substitute 'LIBGCRYPT'., guix-commits, 2019/04/17
- 05/10: installer: Desktop environment page now includes window managers., guix-commits, 2019/04/17