* configure.in, man/po/Makefile.in.in, man/po/Makevars,

man/po/POTFILES.in, man/Makefile.am: Generate the PO files for the
  manpages in the man/po directory (instead of man/<lang>). Use a
  Makefile.in.in based on gettext's one. This ensure that the PO are
  generated before being used in the <lang> directories.
* man/generate_mans.mak, man/generate_translations.mak,
  man/Makefile.am: New makefile for the generation of manpages from
  XML (generate_mans.mak). This avoid duplicate chunks in
  generate_translations.mak and Makefile.am
* man/de/de.po, man/fr/fr.po, man/it/it.po, man/pl/pl.po,
  man/ru/ru.po, man/sv/sv.po: Moved to...
* man/po/de.po, man/po/fr.po, man/po/it.po, man/po/pl.po,
  man/po/ru.po, man/po/sv.po: ... here.
This commit is contained in:
nekral-guest 2007-11-25 21:02:32 +00:00
parent fabc69e9d8
commit 543b693547
14 changed files with 404 additions and 123 deletions

View File

@ -1,3 +1,19 @@
2007-11-25 Nicolas François <nicolas.francois@centraliens.net>
* configure.in, man/po/Makefile.in.in, man/po/Makevars,
man/po/POTFILES.in, man/Makefile.am: Generate the PO files for the
manpages in the man/po directory (instead of man/<lang>). Use a
Makefile.in.in based on gettext's one. This ensure that the PO are
generated before being used in the <lang> directories.
* man/generate_mans.mak, man/generate_translations.mak,
man/Makefile.am: New makefile for the generation of manpages from
XML (generate_mans.mak). This avoid duplicate chunks in
generate_translations.mak and Makefile.am
* man/de/de.po, man/fr/fr.po, man/it/it.po, man/pl/pl.po,
man/ru/ru.po, man/sv/sv.po: Moved to...
* man/po/de.po, man/po/fr.po, man/po/it.po, man/po/pl.po,
man/po/ru.po, man/po/sv.po: ... here.
2007-11-24 Nicolas François <nicolas.francois@centraliens.net> 2007-11-24 Nicolas François <nicolas.francois@centraliens.net>
* src/userdel.c, src/lastlog.c, src/newusers.c, src/chpasswd.c, * src/userdel.c, src/lastlog.c, src/newusers.c, src/chpasswd.c,

View File

@ -350,6 +350,7 @@ AC_CONFIG_FILES([
po/Makefile.in po/Makefile.in
doc/Makefile doc/Makefile
man/Makefile man/Makefile
man/po/Makefile.in
man/cs/Makefile man/cs/Makefile
man/de/Makefile man/de/Makefile
man/es/Makefile man/es/Makefile

View File

@ -1,57 +1,12 @@
LINGUAS = de fr it pl ru sv
# subdirectories for translated manual pages # subdirectories for translated manual pages
DIST_SUBDIRS = cs de es fi fr hu id it ja ko pl pt_BR ru sv tr zh_CN zh_TW
if USE_NLS if USE_NLS
SUBDIRS = $(DIST_SUBDIRS) SUBDIRS = po cs de es fi fr hu id it ja ko pl pt_BR ru sv tr zh_CN zh_TW
else else
SUBDIRS = SUBDIRS =
endif endif
man_XMANS = \
chage.1.xml \
chfn.1.xml \
chgpasswd.8.xml \
chpasswd.8.xml \
chsh.1.xml \
expiry.1.xml \
faillog.5.xml \
faillog.8.xml \
gpasswd.1.xml \
groupadd.8.xml \
groupdel.8.xml \
groupmems.8.xml \
groupmod.8.xml \
groups.1.xml \
grpck.8.xml \
gshadow.5.xml \
lastlog.8.xml \
limits.5.xml \
login.1.xml \
login.access.5.xml \
login.defs.5.xml \
logoutd.8.xml \
newgrp.1.xml \
newusers.8.xml \
nologin.8.xml \
passwd.1.xml \
passwd.5.xml \
porttime.5.xml \
pwck.8.xml \
pwconv.8.xml \
shadow.3.xml \
shadow.5.xml \
sg.1.xml \
su.1.xml \
suauth.5.xml \
useradd.8.xml \
userdel.8.xml \
usermod.8.xml \
vipw.8.xml
man_MANS = \ man_MANS = \
$(man_nopam) \
chage.1 \ chage.1 \
chfn.1 \ chfn.1 \
chgpasswd.8 \ chgpasswd.8 \
@ -103,6 +58,47 @@ if !USE_PAM
man_MANS += $(man_nopam) man_MANS += $(man_nopam)
endif endif
man_XMANS = \
chage.1.xml \
chfn.1.xml \
chgpasswd.8.xml \
chpasswd.8.xml \
chsh.1.xml \
expiry.1.xml \
faillog.5.xml \
faillog.8.xml \
gpasswd.1.xml \
groupadd.8.xml \
groupdel.8.xml \
groupmems.8.xml \
groupmod.8.xml \
groups.1.xml \
grpck.8.xml \
gshadow.5.xml \
lastlog.8.xml \
limits.5.xml \
login.1.xml \
login.access.5.xml \
login.defs.5.xml \
logoutd.8.xml \
newgrp.1.xml \
newusers.8.xml \
nologin.8.xml \
passwd.1.xml \
passwd.5.xml \
porttime.5.xml \
pwck.8.xml \
pwconv.8.xml \
shadow.3.xml \
shadow.5.xml \
sg.1.xml \
su.1.xml \
suauth.5.xml \
useradd.8.xml \
userdel.8.xml \
usermod.8.xml \
vipw.8.xml
EXTRA_DIST = \ EXTRA_DIST = \
$(man_MANS) \ $(man_MANS) \
$(man_XMANS) \ $(man_XMANS) \
@ -110,67 +106,16 @@ EXTRA_DIST = \
id.1 \ id.1 \
id.1.xml \ id.1.xml \
sulogin.8 \ sulogin.8 \
sulogin.8.xml sulogin.8.xml \
generate_mans.mak \
generate_translations.mak
if ENABLE_REGENERATE_MAN if ENABLE_REGENERATE_MAN
if USE_PAM include generate_mans.mak
PAM_COND=pam
else
PAM_COND=no_pam
endif
if SHADOWGRP
SHADOWGRP_COND=gshadow
else
SHADOWGRP_COND=no_gshadow
endif
%: %.xml
$(XSLTPROC) --stringparam profile.condition "$(PAM_COND);$(SHADOWGRP_COND)" \
-nonet http://docbook.sourceforge.net/release/xsl/current/manpages/profile-docbook.xsl $<
grpconv.8 grpunconv.8 pwunconv.8: pwconv.8
getspnam.3: shadow.3
vigr.8: vipw.8
CLEANFILES = $(man_MANS) CLEANFILES = $(man_MANS)
POFILES = $(foreach lang, $(LINGUAS), $(lang)/$(lang).po)
all: $(POFILES)
$(POFILES): shadow-man-pages.pot
shadow-man-pages.pot: $(man_XMANS)
dist-hook: dist-po-files
.PHONY: dist-po-files
dist-po-files: $(POFILES) shadow-man-pages.pot
@for lang in $(LINGUAS); do \
echo " $(mkinstalldirs) $(distdir)/$$lang"; \
$(mkinstalldirs) "$(distdir)/$$lang"; \
done
@for file in $(POFILES); do \
echo "$(INSTALL_DATA) $(srcdir)/$$file $(distdir)/$$file"; \
$(INSTALL_DATA) "$(srcdir)/$$file" "$(distdir)/$$file"; \
done
$(INSTALL_DATA) "$(srcdir)/shadow-man-pages.pot" "$(distdir)/shadow-man-pages.pot"
shadow-man-pages.pot: $(man_XMANS)
xml2po -o $@ $(man_XMANS)
.PHONY: update-po
update-po: shadow-man-pages.pot
@for lang in $(LINGUAS); do \
echo "$$lang:"; \
echo "$(MSGMERGE) -o $$lang/$$lang.po $$lang/$$lang.po shadow-man-pages.pot"; \
$(MSGMERGE) -o $$lang/$$lang.po $$lang/$$lang.po shadow-man-pages.pot; \
done
else else
$(man_MANS): $(man_MANS):
@echo "" @echo ""

30
man/generate_mans.mak Normal file
View File

@ -0,0 +1,30 @@
if ENABLE_REGENERATE_MAN
if USE_PAM
PAM_COND=pam
else
PAM_COND=no_pam
endif
if SHADOWGRP
SHADOWGRP_COND=gshadow
else
SHADOWGRP_COND=no_gshadow
endif
if USE_SHA_CRYPT
SHA_CRYPT_COND=sha_crypt
else
SHA_CRYPT_COND=no_sha_crypt
endif
%: %.xml
$(XSLTPROC) --stringparam profile.condition "$(PAM_COND);$(SHADOWGRP_COND);$(SHA_CRYPT_COND)" \
-nonet http://docbook.sourceforge.net/release/xsl/current/manpages/profile-docbook.xsl $<
grpconv.8 grpunconv.8 pwunconv.8: pwconv.8
getspnam.3: shadow.3
vigr.8: vipw.8
endif

View File

@ -2,30 +2,11 @@ if ENABLE_REGENERATE_MAN
LANG=$(notdir $(CURDIR)) LANG=$(notdir $(CURDIR))
%.xml: ../%.xml $(LANG).po %.xml: ../%.xml ../po/$(LANG).po
xml2po -l $(LANG) -p $(LANG).po -o $@ ../$@ xml2po -l $(LANG) -p ../po/$(LANG).po -o $@ ../$@
sed -i 's:\(^<refentry .*\)>:\1 lang="$(LANG)">:' $@ sed -i 's:\(^<refentry .*\)>:\1 lang="$(LANG)">:' $@
if USE_PAM include ../generate_mans.mak
PAM_COND=pam
else
PAM_COND=no_pam
endif
if SHADOWGRP
SHADOWGRP_COND=gshadow
else
SHADOWGRP_COND=no_gshadow
endif
%: %.xml
$(XSLTPROC) --stringparam profile.condition "$(PAM_COND);$(SHADOWGRP_COND)" \
-nonet http://docbook.sourceforge.net/release/xsl/current/manpages/profile-docbook.xsl $<
grpconv.8 grpunconv.8 pwunconv.8: pwconv.8
getspnam.3: shadow.3
vigr.8: vipw.8
CLEANFILES = .xml2po.mo $(EXTRA_DIST) $(addsuffix .xml,$(EXTRA_DIST)) CLEANFILES = .xml2po.mo $(EXTRA_DIST) $(addsuffix .xml,$(EXTRA_DIST))

240
man/po/Makefile.in.in Normal file
View File

@ -0,0 +1,240 @@
# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public
# License but which still want to provide support for the GNU gettext
# functionality.
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
#
# Origin: gettext-0.16
# Modified to handle translations with xml2po by Nicolas François - 2007
PACKAGE = @PACKAGE@
VERSION = @VERSION@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
SHELL = /bin/sh
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
MSGFMT_ = @MSGFMT@
MSGFMT_no = @MSGFMT@
MSGFMT_yes = @MSGFMT_015@
MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
XGETTEXT_ = @XGETTEXT@
XGETTEXT_no = @XGETTEXT@
XGETTEXT_yes = @XGETTEXT_015@
XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
MSGMERGE = msgmerge
MSGMERGE_UPDATE = @MSGMERGE@ --update
MSGINIT = msginit
MSGCONV = msgconv
MSGFILTER = msgfilter
POFILES = @POFILES@
UPDATEPOFILES = @UPDATEPOFILES@
DUMMYPOFILES = @DUMMYPOFILES@
DISTFILES.common = Makefile.in.in remove-potcdate.sin
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(POFILES)
POTFILES = \
# Makevars gets inserted here. (Don't remove this line!)
.SUFFIXES:
.SUFFIXES: .po .sed .sin .nop .po-create .po-update
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@
all: all-@USE_NLS@
all-yes: stamp-po
all-no:
# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
# we don't want to bother translators with empty POT files). We assume that
# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
# In this case, stamp-po is a nop (i.e. a phony target).
# stamp-po is a timestamp denoting the last time at which the CATALOGS have
# been loosely updated. Its purpose is that when a developer or translator
# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
# invocations of "make" will do nothing. This timestamp would not be necessary
# if updating the $(CATALOGS) would always touch them; however, the rule for
# $(POFILES) has been designed to not touch files that don't need to be
# changed.
stamp-po: $(srcdir)/$(DOMAIN).pot
@test ! -f $(srcdir)/$(DOMAIN).pot || { \
echo "touch stamp-po" && \
echo timestamp > stamp-poT && \
mv stamp-poT stamp-po; \
}
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
# otherwise packages like GCC can not be built if only parts of the source
# have been downloaded.
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
# TODO: set MSGID_BUGS_ADDRESS, COPYRIGHT_HOLDER
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
@tmpdir=`pwd`; \
echo -n "cd $(top_srcdir)/man && "; \
echo "xml2po -o $(tmpdir)/$(DOMAIN).po $(notdir $(POTFILES))"; \
cd $(top_srcdir)/man; \
xml2po -o $$tmpdir/$(DOMAIN).po $(notdir $(POTFILES)); \
cd $$tmpdir
test ! -f $(DOMAIN).po || { \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
else \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
else \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
}
# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
# every "make" invocation, only create it when it is missing.
# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
$(srcdir)/$(DOMAIN).pot:
$(MAKE) $(DOMAIN).pot-update
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
# Note that a PO file is not touched if it doesn't need to be changed.
$(POFILES): $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
if test -f "$(srcdir)/$${lang}.po"; then \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
else \
$(MAKE) $${lang}.po-create; \
fi
install: install-exec install-data
install-exec:
install-data:
install-strip: install
installdirs: installdirs-exec installdirs-data
installdirs-exec:
installdirs-data:
# Define this as empty until I found a useful application.
installcheck:
uninstall: uninstall-exec uninstall-data
uninstall-exec:
uninstall-data:
check: all
info dvi ps pdf html tags TAGS ctags CTAGS ID:
mostlyclean:
rm -f remove-potcdate.sed
rm -f stamp-poT
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f stamp-po
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir:
$(MAKE) update-po
@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: stamp-po $(DISTFILES)
dists="$(DISTFILES)"; \
if test -f $(srcdir)/$(DOMAIN).pot; then \
dists="$$dists $(DOMAIN).pot stamp-po"; \
fi; \
if test -f $(srcdir)/ChangeLog; then \
dists="$$dists ChangeLog"; \
fi; \
for i in 0 1 2 3 4 5 6 7 8 9; do \
if test -f $(srcdir)/ChangeLog.$$i; then \
dists="$$dists ChangeLog.$$i"; \
fi; \
done; \
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
for file in $$dists; do \
if test -f $$file; then \
cp -p $$file $(distdir) || exit 1; \
else \
cp -p $(srcdir)/$$file $(distdir) || exit 1; \
fi; \
done
update-po: Makefile
$(MAKE) $(DOMAIN).pot-update
test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
# General rule for creating PO files.
.nop.po-create:
@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
exit 1
# General rule for updating PO files.
.nop.po-update:
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$lang.po failed!" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
fi
$(DUMMYPOFILES):
Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
cd $(top_builddir) \
&& $(SHELL) ./config.status $(subdir)/$@.in po-directories
force:
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

27
man/po/Makevars Normal file
View File

@ -0,0 +1,27 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)-man-pages
# These two variables depend on the location of this directory.
subdir = man/po
top_builddir = ../..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --no-location
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
MSGID_BUGS_ADDRESS = pkg-shadow-devel@lists.alioth.debian.org

41
man/po/POTFILES.in Normal file
View File

@ -0,0 +1,41 @@
# List of xml which contain translatable strings.
man/chage.1.xml
man/chfn.1.xml
man/chgpasswd.8.xml
man/chpasswd.8.xml
man/chsh.1.xml
man/expiry.1.xml
man/faillog.5.xml
man/faillog.8.xml
man/gpasswd.1.xml
man/groupadd.8.xml
man/groupdel.8.xml
man/groupmems.8.xml
man/groupmod.8.xml
man/groups.1.xml
man/grpck.8.xml
man/gshadow.5.xml
man/lastlog.8.xml
man/limits.5.xml
man/login.1.xml
man/login.access.5.xml
man/login.defs.5.xml
man/logoutd.8.xml
man/newgrp.1.xml
man/newusers.8.xml
man/nologin.8.xml
man/passwd.1.xml
man/passwd.5.xml
man/porttime.5.xml
man/pwck.8.xml
man/pwconv.8.xml
man/shadow.3.xml
man/shadow.5.xml
man/sg.1.xml
man/su.1.xml
man/suauth.5.xml
man/useradd.8.xml
man/userdel.8.xml
man/usermod.8.xml
man/vipw.8.xml