Subject: [bug#63483] [PATCH 3/4] self: Update po4a process.

From: gemmaro <[email-masked]>
Date: Sat, 13 May 2023 19:36:15 +0900

---
 guix/self.scm | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/guix/self.scm b/guix/self.scm
index 74c953bd50e..c9fedae0ea3 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017-2022 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2020 Martin Becze <[email-masked]>
+;;; Copyright © 2023 gemmaro <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -307,12 +308,14 @@ (define (translate-texi-manuals source)
                        (ice-9 vlist) (ice-9 threads)
                        (srfi srfi-1))
 
-          (define (translate-tmp-texi po source output)
-            "Translate Texinfo file SOURCE using messages from PO, and write
-the result to OUTPUT."
-            (invoke #+(file-append po4a "/bin/po4a-translate")
-              "-M" "UTF-8" "-L" "UTF-8" "-k" "0" "-f" "texinfo"
-              "-m" source "-p" po "-l" output))
+          (define (translate-tmp-texi)
+            "Translate Texinfo files using messages from PO, except for cross
+references."
+            (invoke #+(file-append po4a "/bin/po4a")
+                    "--no-update"
+                    (string-append "--srcdir=" #$source)
+                    "--destdir=."
+                    #+(file-append documentation-po "/po4a.cfg")))
 
           (define (canonicalize-whitespace str)
             ;; Change whitespace (newlines, etc.) in STR to #\space.
@@ -322,17 +325,11 @@ (define (translate-texi-manuals source)
                               chr))
                         str))
 
-          (define* (translate-texi prefix po lang
-                                   #:key (extras '()))
-            "Translate the manual for one language LANG using the PO file.
-PREFIX must be the prefix of the manual, 'guix' or 'guix-cookbook'.  EXTRAS is
-a list of extra files, such as '(\"contributing\")."
-            (for-each (lambda (file)
-                        (translate-tmp-texi po (string-append file ".texi")
-                                            (string-append file "." lang
-                                                           ".texi.tmp")))
-                      (cons prefix extras))
-
+          (define* (translate-texi-xrefs prefix po lang
+                                         #:key (extras '()))
+            "Translate cross references in the manual for one language LANG using the
+PO file.  PREFIX must be the prefix of the manual, 'guix' or 'guix-cookbook'.  EXTRAS
+is a list of extra files, such as '(\"contributing\")."
             (for-each (lambda (file)
                         (let* ((texi (string-append file "." lang ".texi"))
                                (tmp  (string-append texi ".tmp")))
@@ -374,17 +371,19 @@ (define (translate-texi-manuals source)
           (setenv "LC_ALL" "en_US.UTF-8")
           (setlocale LC_ALL "en_US.UTF-8")
 
+          (translate-tmp-texi)
+
           (n-par-for-each parallel-jobs
                           (match-lambda
                             ((language . po)
-                             (translate-texi "guix" po language
-                                             #:extras '("contributing"))))
+                             (translate-texi-xrefs "guix" po language
+                                                   #:extras '("contributing"))))
                           (available-translations "." "guix-manual"))
 
           (n-par-for-each parallel-jobs
                           (match-lambda
                             ((language . po)
-                             (translate-texi "guix-cookbook" po language)))
+                             (translate-texi-xrefs "guix-cookbook" po language)))
                           (available-translations "." "guix-cookbook"))
 
           (for-each (lambda (file)
-- 
2.39.2