Manpage translations in Makefiles

The translated manpage generation has moved from scripts to
Makefiles. This asists with conditional building as well, no
need to regenerate the German pgrep man page if both
the original pgrep.1 and man-po/de.po is not changed.

My Makefile-fu fails me on producing a cross-product or double
iteration for languages and man pages. Until that is solved
each man page is explicitly built. No big deal but it doesn't
look elegant in the Makefile. Languages will be picked
up automatically if they are found in man-po, man-po/top or
man-po/ps

The README describes the three-step process for translating
the files, incase I forget or someone else wants to update them.
This commit is contained in:
Craig Small 2014-06-28 23:38:13 +10:00
parent 889ad23842
commit 0f8f760307
9 changed files with 8850 additions and 28 deletions

View File

@ -9,6 +9,7 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = \
include \
lib \
man-po \
po \
proc \
ps \
@ -47,8 +48,6 @@ dist_man_MANS = \
EXTRA_DIST = \
autogen.sh \
create-man-pot.sh \
translate-man.sh \
contrib \
COPYING.LIB \
misc/git-version-gen \
@ -128,31 +127,6 @@ $(top_srcdir)/.version:
echo $(VERSION) > $@-t && mv $@-t $@
dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version
# $(srcdir)/create-man-pot.sh
$(srcdir)/translate-man.sh
MAN_PS_POT = man-po/template-man-ps.pot
MAN_PS_POT_FILES = $(srcdir)/ps/ps.1
MAN_TOP_POT = man-po/template-man-top.pot
MAN_TOP_POT_FILES = $(srcdir)/top/top.1
MAN_POT = man-po/template-man.pot
MAN_POT_FILES = $(srcdir)/free.1 $(srcdir)/kill.1 $(srcdir)/pgrep.1 \
$(srcdir)/pidof.1 $(srcdir)/pkill.1 $(srcdir)/pmap.1 \
$(srcdir)/pwdx.1 $(srcdir)/skill.1 $(srcdir)/slabtop.1 \
$(srcdir)/snice.1 $(srcdir)/sysctl.8 $(srcdir)/uptime.1 \
$(srcdir)/sysctl.conf.5 $(srcdir)/tload.1 \
$(srcdir)/vmstat.8 $(srcdir)/w.1 $(srcdir)/watch.1
DIST_MAN_POTS = $(MAN_PS_POT) $(MAN_TOP_POT) $(MAN_POT)
CLEANFILES = $(DIST_MAN_POTS)
$(MAN_PS_POT): $(MAN_PS_POT_FILES)
po4a-updatepo -f man -m $< -p $@
$(MAN_TOP_POT): $(MAN_TOP_POT_FILES)
po4a-updatepo -f man -m $< -p $@
$(MAN_POT): $(MAN_POT_FILES)
po4a-updatepo -f man -m $< -p $@
get-trans:
echo "Getting the latest translations from translationproject.org..."

19
README
View File

@ -43,6 +43,25 @@ PACKAGING
For normal packages, ensure that you do not add debugging flags
to the CFLAGS variable.
TRANSLATING MAN PAGES
There is a three-step process for translating man pages. Most
of the work happens in the man-po directory.
make -C man-po translate-templates
Creates the translation templates (the .pot files) for translators
to use as a base. These, along with the tar file, should be sent
to the tp-coorindator before release.
make get-trans
rsyncs the latest translated (.po) files for both the programs and
man pages.
make -C man-po translate-mans
This is also called in the dist-hook and is where the translation
magic happens. Take the original man page, the relevant .po file
and produce a translated man page in that language.
All of the man pages generated are found in
man-po/(LANG)/man(SECTION)/
UPSTREAM & BUG REPORTS
procps-ng <procps@freelists.org>

View File

@ -266,6 +266,7 @@ AC_CHECK_FUNCS([__fpending alarm atexit dup2 getpagesize gettimeofday iswprint m
AC_CONFIG_FILES([Makefile
include/Makefile
lib/Makefile
man-po/Makefile
po/Makefile.in
proc/Makefile
proc/libprocps.pc

1
lib/.gitignore vendored
View File

@ -1,3 +1,4 @@
.dirstamp
test_fileutils
test_strutils
test_nsutils

View File

@ -2,7 +2,8 @@ AM_CPPFLAGS = -include $(top_builddir)/config.h -I$(top_srcdir)/include
AM_CPPFLAGS += -DTEST_PROGRAM
noinst_PROGRAMS = test_strutils test_fileutils
noinst_PROGRAMS = test_strutils test_fileutils test_nsutils
test_strutils_SOURCES = strutils.c
test_fileutils_SOURCES = fileutils.c
test_nsutils_SOURCES = nsutils.c

View File

@ -9,6 +9,13 @@
#include "proc/readproc.h"
#include "nsutils.h"
#ifdef TEST_PROGRAM
const char *get_ns_name(int id)
{
return NULL;
}
#endif /* TEST_PROGRAM */
/* we need to fill in only namespace information */
int ns_read(pid_t pid, proc_t *ns_task)
{
@ -30,3 +37,11 @@ int ns_read(pid_t pid, proc_t *ns_task)
return rc;
}
#ifdef TEST_PROGRAM
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello, World!\n");
return EXIT_SUCCESS;
}
#endif /* TEST_PROGRAM */

2
man-po/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.pot
/de/

131
man-po/Makefile.am Normal file
View File

@ -0,0 +1,131 @@
translate-templates: $(DIST_MAN_POTS)
get-trans:
rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man/ .
rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man-ps/ ps
rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man-top/ top
translate-mans: dist-man-paths $(translated_MANS)
base_langs := $(patsubst %.po,%,$(wildcard *.po))
top_langs := $(patsubst %.po,%,$(notdir $(wildcard top/*.po)))
ps_langs := $(patsubst %.po,%,$(notdir $(wildcard ps/*.po)))
all_langs = $(base_langs) $(top_langs) $(ps_langs)
MAN_SECTIONS = 1 5 8
MAN_PAGES = free.1 kill.1 pgrep.1 pidof.1 pkill.1 pmap.1 pwdx.1 skill.1 slabtop.1 \
tload.1 uptime.1 w.1 watch.1 \
sysctl.conf.5 \
sysctl.8 vmstat.8
man1_pages := $(foreach man,$(filter %.1, $(MAN_PAGES)), man1/$(man))
man5_pages := $(foreach man,$(filter %.5, $(MAN_PAGES)), man5/$(man))
man8_pages := $(foreach man,$(filter %.8, $(MAN_PAGES)), man8/$(man))
man_pages = $(man1_pages) $(man8_pages)
man_paths = $(foreach lang, $(base_langs), $(foreach section,$(MAN_SECTIONS),$(lang)/man$(section))) \
$(foreach lang, $(top_langs), $(lang)/man1) \
$(foreach lang, $(ps_langs), $(lang)/man1)
translated_MANS :=$(foreach lang,$(base_langs), $(foreach manpage,$(man_pages),$(lang)/$(manpage)))
translated_MANS +=$(foreach lang,$(top_langs), $(lang)/man1/top.1)
translated_MANS +=$(foreach lang,$(ps_langs), $(lang)/man1/ps.1)
PO4A_UPDATEPO = po4a-updatepo
PO4A_TRANSLATE = po4a-translate
translate_manpage = $(PO4A_TRANSLATE) -f man -m $< -p $*.po -l $@
CLEANFILES = $(DIST_MAN_POTS)
maintainer-clean-local:
-rm -rf $(all_langs)
MAN_PS_POT = template-man-ps.pot
MAN_PS_POT_FILES = $(top_srcdir)/ps/ps.1
MAN_TOP_POT = template-man-top.pot
MAN_TOP_POT_FILES = $(top_srcdir)/top/top.1
MAN_POT = template-man.pot
MAN_POT_FILES = $(top_srcdir)/free.1 $(top_srcdir)/kill.1 $(top_srcdir)/pgrep.1 \
$(top_srcdir)/pidof.1 $(top_srcdir)/pkill.1 $(top_srcdir)/pmap.1 \
$(top_srcdir)/pwdx.1 $(top_srcdir)/skill.1 $(top_srcdir)/slabtop.1 \
$(top_srcdir)/snice.1 $(top_srcdir)/sysctl.8 $(top_srcdir)/uptime.1 \
$(top_srcdir)/sysctl.conf.5 $(top_srcdir)/tload.1 \
$(top_srcdir)/vmstat.8 $(top_srcdir)/w.1 $(top_srcdir)/watch.1
DIST_MAN_POTS = $(MAN_PS_POT) $(MAN_TOP_POT) $(MAN_POT)
$(MAN_PS_POT): $(MAN_PS_POT_FILES)
$(PO4A_UPDATEPO) -f man -m $< -p $@
$(MAN_TOP_POT): $(MAN_TOP_POT_FILES)
$(PO4A_UPDATEPO) -f man -m $< -p $@
$(MAN_POT): $(MAN_POT_FILES)
$(PO4A_UPDATEPO) -f man -m $< -p $@
dist_man_MANS = $(foreach lang, $(all_langs), $(foreach section, $(MAN_SECTIONS), $(wildcard $(lang)/man$(section)/*.$(section))))
dist-hook: translate-mans
echo $(translated_MANS)
dist-man-paths:
echo $(top_langs)
@for p in $(man_paths) ; do \
echo " $(MKDIR_P) '$$p'"; \
done
# My Makefile-fu fails me here, I cannot see how to have double-wildcards
# or have rules and recipies split
#
%/man1/top.1: ../top/top.1 top/%.po
$(PO4A_TRANSLATE) -f man -m $< -p top/$*.po -l $@
%/man1/ps.1: ../ps/ps.1 ps/%.po
$(PO4A_TRANSLATE) -f man -m $< -p ps/$*.po -l $@
%/man1/free.1: ../free.1 %.po
$(translate_manpage)
%/man1/kill.1: ../kill.1 %.po
$(translate_manpage)
%/man1/pgrep.1: ../pgrep.1 %.po
$(translate_manpage)
%/man1/pidof.1: ../pidof.1 %.po
$(translate_manpage)
%/man1/pkill.1: ../pkill.1 %.po
$(translate_manpage)
%/man1/pmap.1: ../pmap.1 %.po
$(translate_manpage)
%/man1/pwdx.1: ../pwdx.1 %.po
$(translate_manpage)
%/man1/skill.1: ../skill.1 %.po
$(translate_manpage)
%/man1/slabtop.1: ../slabtop.1 %.po
$(translate_manpage)
%/man1/tload.1: ../tload.1 %.po
$(translate_manpage)
%/man1/uptime.1: ../uptime.1 %.po
$(translate_manpage)
%/man1/w.1: ../w.1 %.po
$(translate_manpage)
%/man1/watch.1: ../watch.1 %.po
$(translate_manpage)
%/man5/sysctl.conf.5: ../sysctl.conf.5 %.po
$(translate_manpage)
%/man8/sysctl.8: ../sysctl.8 %.po
$(translate_manpage)
%/man8/vmstat.8: ../vmstat.8 %.po
$(translate_manpage)
.PHONY = translate-mans dist-man-paths

8678
man-po/de.po Normal file

File diff suppressed because it is too large Load Diff