guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: profiles: 'info-dir-file' hook now produces 'dir.LANG' files.


From: Ludovic Courtès
Subject: 01/03: profiles: 'info-dir-file' hook now produces 'dir.LANG' files.
Date: Wed, 4 Jul 2018 10:11:38 -0400 (EDT)

civodul pushed a commit to branch version-0.15.0
in repository guix.

commit 5b0c648a7c5ac3d827bb6fc61b3b2037a2d4b62c
Author: Ludovic Courtès <address@hidden>
Date:   Wed Jul 4 10:52:59 2018 +0200

    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.
---
 guix/profiles.scm | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index ebd7da2..e6b77e8 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]