diff --git a/doc/local.mk b/doc/local.mk index 9619971296..627d27a5ef 100644 --- a/doc/local.mk +++ b/doc/local.mk @@ -5,6 +5,7 @@ # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer # Copyright © 2016, 2018 Mathieu Lirzin # Copyright © 2018, 2021 Julien Lepiller +# Copyright © 2021 Maxime Devos # # This file is part of GNU Guix. # @@ -111,22 +112,33 @@ $(top_srcdir)/pre-inst-env $(GUILE) --no-auto-compile \ $@.tmp $< endef +# This canned recipe is used in the rules below to translate a Texinfo manual +# using the translations in po/doc. The argument $(1) is the name of the +# untranslated manual, without a .texi extension or directory prefixes. +define translate_manual_command + -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/$(1).texi" -p "$<" -l "$@.tmp" + -sed -i "s|$(1)\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp" + -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) + -mv "$@.tmp" "$@" +endef + +# Likewise, but for individual chapters (or sections), which do not have an +# Info file name to modify. +define translate_chapter_command + -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/$(1).texi" -p "$<" -l "$@.tmp" + -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) + -mv "$@.tmp" "$@" +endef + + $(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" - -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp" - -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) - -mv "$@.tmp" "$@" + $(call translate_manual_command,guix) $(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" - -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" "$@" + $(call translate_manual_command,guix-cookbook) $(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_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) - -mv "$@.tmp" "$@" + $(call translate_manual_chapter,contributing) %D%/os-config-%.texi: gnu/system/examples/%.tmpl $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \