From 6c6c8d3a33bba32277e1ed46f55df1e6dbc914b7 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 3 Nov 2019 09:51:07 +0100 Subject: [PATCH] man: generate translations using itstool instead of xml2po This patch was taken from Fedora Rawhide https://src.fedoraproject.org/rpms/shadow-utils/raw/b41cff195605b29af23d2ad62a60ddc5a2d89786/f/shadow-4.6-use-itstool.patch --- man/README.md | 2 +- man/generate_translations.mak | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/man/README.md b/man/README.md index ebe2728f..3180139b 100644 --- a/man/README.md +++ b/man/README.md @@ -7,4 +7,4 @@ pre-built ones might not fit your version of shadow. To build them yourself use - xsltproc - docbook 4 - docbook stylesheets -- xml2po +- itstool diff --git a/man/generate_translations.mak b/man/generate_translations.mak index 7d242cc9..eb9ac411 100644 --- a/man/generate_translations.mak +++ b/man/generate_translations.mak @@ -5,8 +5,19 @@ config.xml: ../config.xml.in $(MAKE) -C .. config.xml cp ../config.xml $@ -%.xml: ../%.xml ../po/$(LANG).po - xml2po --expand-all-entities -l $(LANG) -p ../po/$(LANG).po -o $@ ../$@ +messages.mo: ../po/$(LANG).po + msgfmt ../po/$(LANG).po -o messages.mo + +login.defs.d: + ln -sf ../login.defs.d login.defs.d + +%.xml: ../%.xml messages.mo login.defs.d + if grep -q SHADOW-CONFIG-HERE $< ; then \ + sed -e 's/^/%config;/' $< > $@; \ + else \ + sed -e 's/^\(/\1 [%config;]>/' $< > $@; \ + fi + itstool -d -l $(LANG) -m messages.mo -o . $@ sed -i 's:\(^:\1 lang="$(LANG)">:' $@ include ../generate_mans.mak @@ -16,4 +27,4 @@ $(man_MANS): @echo you need to run configure with --enable-man to generate man pages endif -CLEANFILES = .xml2po.mo $(EXTRA_DIST) $(addsuffix .xml,$(EXTRA_DIST)) config.xml +CLEANFILES = messages.mo login.defs.d $(EXTRA_DIST) $(addsuffix .xml,$(EXTRA_DIST)) config.xml