diff mbox series

[bug#63483,v2,3/4] build: Use the po4a command for the translation generation.

Message ID 1c856bb1f6ec8a648775a919f360d3ec878b6575.1713073114.git.gemmaro.dev@gmail.com
State New
Headers show
Series build: Update po4a process. | expand

Commit Message

gemmaro April 14, 2024, 7:18 a.m. UTC
* configure.ac (Documentation translation): Remove the po4a-translate command.
This command has been replaced by the po4a command and are not used from
anywhere.
* doc/local.mk ($(srcdir)/%D%/guix.%.texi, $(srcdir)/%D%/guix-cookbook.%.texi)
($(srcdir)/%D%/contributing.%.texi): Use the po4a command instead of the
po4a-translate for the translation generation.  This eliminates the warning of
po4a-translate; "po4a-translate is deprecated.  The unified po4a(1) program is
more convenient and less error prone."
(PO4A_PARAMS): Remove the Texinfo format option.  This option is specified in
the configuration file (po/doc/po4a.cfg).
(dummy_pot): Add a variable for the temporary POT file location.

Change-Id: I542b934c3c03b8701e9f86823191224f8b0ccf81
---
 configure.ac    |  1 -
 doc/local.mk    | 30 +++++++++++++++++++++++-------
 po/doc/local.mk |  5 -----
 3 files changed, 23 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 68542f0348..ad148f33b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -263,7 +263,6 @@  AM_MISSING_PROG([HELP2MAN], [help2man])
 
 dnl Documentation translation.
 AM_MISSING_PROG([PO4A], [po4a])
-AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate])
 
 case "$storedir" in
   /gnu/store)
diff --git a/doc/local.mk b/doc/local.mk
index 8df003b891..a6234b2e3e 100644
--- a/doc/local.mk
+++ b/doc/local.mk
@@ -5,6 +5,7 @@ 
 # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
 # Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org>
 # Copyright © 2018, 2021 Julien Lepiller <julien@lepiller.eu>
+# Copyright © 2024 gemmaro <gemmaro.dev@gmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -87,10 +88,6 @@  BUILT_SOURCES        += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
 EXTRA_DIST           += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
 MAINTAINERCLEANFILES  = $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
 
-PO4A_PARAMS := -M UTF-8 -L UTF-8 #master and localized encoding
-PO4A_PARAMS += -k 0 # produce an output even if the translation is not complete
-PO4A_PARAMS += -f texinfo # texinfo format
-
 # When a change to guix.texi occurs, it is not translated immediately.
 # Because @pxref and @xref commands are references to sections by name, they
 # should be translated. If a modification adds a reference to a section, this
@@ -102,20 +99,39 @@  $(top_srcdir)/pre-inst-env $(GUILE) --no-auto-compile	\
   $@.tmp $<
 endef
 
+# If /dev/null is used for this POT file path, a warning will be issued
+# because the path extension is not 'pot'.
+dummy_pot = $(shell mktemp --suffix=.pot)
+
 $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi guix/build/po.go
-	-$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp"
+	-$(AM_V_PO4A)$(PO4A) --no-update		\
+		--variable localized="$@.tmp"		\
+		--variable master="%D%/guix.texi"	\
+		--variable po="$<"			\
+		--variable pot=$(dummy_pot)		\
+		po/doc/po4a.cfg
 	-sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
 	-$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command)
 	-mv "$@.tmp" "$@"
 
 $(srcdir)/%D%/guix-cookbook.%.texi: po/doc/guix-cookbook.%.po guix/build/po.go
-	-$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix-cookbook.texi" -p "$<" -l "$@.tmp"
+	-$(AM_V_PO4A)$(PO4A) --no-update			\
+		--variable localized="$@.tmp"			\
+		--variable master="%D%/guix-cookbook.texi"	\
+		--variable po="$<"				\
+		--variable pot=$(dummy_pot)			\
+		po/doc/po4a.cfg
 	-sed -i "s|guix-cookbook\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
 	-$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command)
 	-mv "$@.tmp" "$@"
 
 $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po guix/build/po.go
-	-$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp"
+	-$(AM_V_PO4A)$(PO4A) --no-update			\
+		--variable localized="$@.tmp"			\
+		--variable master="%D%/contributing.texi"	\
+		--variable po="$<"				\
+		--variable pot=$(dummy_pot)			\
+		po/doc/po4a.cfg
 	-$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command)
 	-mv "$@.tmp" "$@"
 
diff --git a/po/doc/local.mk b/po/doc/local.mk
index 8a78fb23f8..a1f1875623 100644
--- a/po/doc/local.mk
+++ b/po/doc/local.mk
@@ -39,11 +39,6 @@  EXTRA_DIST = \
   $(DOC_PO_FILES) \
   $(DOC_COOKBOOK_PO_FILES)
 
-POT_OPTIONS = \
-	--package-name "guix manual" --package-version "$(VERSION)" 	\
-	--copyright-holder "the authors of Guix (msgids)" 		\
-	--msgid-bugs-address "bug-guix@gnu.org"
-
 %D%/%.pot: $(srcdir)/doc/%.texi
 	$(AM_V_PO4A)$(PO4A) --no-translations -M UTF-8	\
 		--package-version "$(VERSION)"		\