aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-07-04 10:52:59 +0200
committerLudovic Courtès <ludo@gnu.org>2018-07-04 10:52:59 +0200
commit5b0c648a7c5ac3d827bb6fc61b3b2037a2d4b62c (patch)
tree4726b6b2676dff310054e520b57cb9b010abaf9a
parenta51cf16031c974ffa238e5dd9ced32f0d68c9227 (diff)
downloadguix-5b0c648a7c5ac3d827bb6fc61b3b2037a2d4b62c.tar
guix-5b0c648a7c5ac3d827bb6fc61b3b2037a2d4b62c.tar.gz
profiles: 'info-dir-file' hook now produces 'dir.LANG' files.
Previously, entries for 'guix.fr.info' would end up in 'dir', above the 'guix.info' entries; consequently, running 'info guix' would actually open 'guix.fr.info', which was confusing for non-French readers. * guix/profiles.scm (info-dir-file)[glibc-utf8-locales]: New variable. [build](info-file-language): New procedure. (install-info): Use it, to create 'dir.LANG' files. Set GUIX_LOCPATH.
-rw-r--r--guix/profiles.scm30
1 files changed, 26 insertions, 4 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index ebd7da2a24..e6b77e8d38 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -703,6 +703,8 @@ MANIFEST."
(module-ref (resolve-interface '(gnu packages texinfo)) 'texinfo))
(define gzip ;lazy reference
(module-ref (resolve-interface '(gnu packages compression)) 'gzip))
+ (define glibc-utf8-locales ;lazy reference
+ (module-ref (resolve-interface '(gnu packages base)) 'glibc-utf8-locales))
(define build
(with-imported-modules '((guix build utils))
@@ -720,11 +722,31 @@ MANIFEST."
(map (cut string-append infodir "/" <>)
(or (scandir infodir info-file?) '()))))
+ (define (info-file-language file)
+ (let* ((base (if (string-suffix? ".gz" file)
+ (basename file ".info.gz")
+ (basename file ".info")))
+ (dot (string-rindex base #\.)))
+ (if dot
+ (string-drop base (+ 1 dot))
+ "en")))
+
(define (install-info info)
- (setenv "PATH" (string-append #+gzip "/bin")) ;for info.gz files
- (zero?
- (system* (string-append #+texinfo "/bin/install-info") "--silent"
- info (string-append #$output "/share/info/dir"))))
+ (let ((language (info-file-language info)))
+ ;; We need to choose a valid locale for $LANGUAGE to be honored.
+ (setenv "LC_ALL" "en_US.utf8")
+ (setenv "LANGUAGE" language)
+ (zero?
+ (system* #+(file-append texinfo "/bin/install-info")
+ "--silent" info
+ (apply string-append #$output "/share/info/dir"
+ (if (string=? "en" language)
+ '("")
+ `("." ,language)))))))
+
+ (setenv "PATH" (string-append #+gzip "/bin")) ;for info.gz files
+ (setenv "GUIX_LOCPATH"
+ #+(file-append glibc-utf8-locales "/lib/locale"))
(mkdir-p (string-append #$output "/share/info"))
(exit (every install-info