Skip to content

Commit

Permalink
man: generate translations using itstool instead of xml2po
Browse files Browse the repository at this point in the history
  • Loading branch information
FRidh committed Nov 3, 2019
1 parent a8a9211 commit 6c6c8d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion man/README.md
Expand Up @@ -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
17 changes: 14 additions & 3 deletions man/generate_translations.mak
Expand Up @@ -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/^<!-- SHADOW-CONFIG-HERE -->/<!ENTITY % config SYSTEM "config.xml">%config;/' $< > $@; \
else \
sed -e 's/^\(<!DOCTYPE .*docbookx.dtd"\)>/\1 [<!ENTITY % config SYSTEM "config.xml">%config;]>/' $< > $@; \
fi
itstool -d -l $(LANG) -m messages.mo -o . $@
sed -i 's:\(^<refentry .*\)>:\1 lang="$(LANG)">:' $@

include ../generate_mans.mak
Expand All @@ -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

0 comments on commit 6c6c8d3

Please sign in to comment.