Files
libguestfs/po-docs/Makefile.am
Richard Jones 8c48f5ae2e Allow manual pages and POD files to be translated.
This uses the optional po4a package to split these files into
PO files for translation, and reassemble afterwards.

Note this creates an extra pot file (po-docs/libguestfs-docs.pot).
We don't (yet) combine this with the main po/libguestfs.pot file.
The 'libguestfs-docs.pot' file included in this commit is not the
real thing, just a short cut down snippet for testing.  The real
thing is created if you update one of the dependent files and
rebuild.

Note also the dummy ja.po, for testing the principles.
2010-09-02 20:37:06 +01:00

89 lines
2.6 KiB
Makefile

# libguestfs translations of man pages and POD files
# Copyright (C) 2010 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# XXX The use of po4a is naive here. Also we should integrate this
# into the po/ directory and the translations into the usual
# libguestfs.pot file.
# Languages.
LINGUAS = ja
EXTRA_DIST = \
libguestfs-docs.pot \
$(LINGUAS:%=%.po)
CLEANFILES = po4a.conf
# Build the final man pages from the translated POD files. Each
# language directory contains a Makefile.am that we need to keep up to
# date (note each $lang/Makefile.am should be identical).
# XXX Is there a better way?
SUBDIRS = $(LINGUAS)
# List of english POD sources which can be translated.
# Perl files count as POD as far as po4a is concerned.
PODFILES = \
../src/guestfs.pod \
../src/guestfs-actions.pod \
../src/guestfs-availability.pod \
../src/guestfs-structs.pod \
../fish/guestfish.pod \
../fish/guestfish-actions.pod \
../test-tool/libguestfs-test-tool.pod \
../fuse/guestmount.pod \
../inspector/virt-inspector.pl \
$(wildcard ../tools/virt-*.pl)
if HAVE_PO4A
update-po: libguestfs-docs.pot
else
update-po:
endif
if HAVE_PO4A
# Note: po4a leaves empty '=encoding' lines in POD files. Also it
# includes a large warning message which ends up in the output. We
# post-process the output to remove both.
libguestfs-docs.pot: po4a.conf
$(PO4A) \
-M utf-8 -L utf-8 -A utf-8 \
-v \
-k 0 \
--package-name $(PACKAGE_NAME) \
--package-version $(PACKAGE_VERSION) \
--msgid-bugs-address libguestfs@redhat.com \
--copyright-holder "Red Hat Inc." \
po4a.conf
for f in `find $(LINGUAS) -name '*.pod' -o -name '*.pl'`; do \
awk 'FNR >= 14 { print }' < $$f > $$f.new; \
mv $$f.new $$f; \
done
po4a.conf: $(PODFILES)
rm -f $@-t
echo "[po_directory] ." >> $@-t
echo >> $@-t
for f in $(PODFILES); do \
b=`basename -- $$f`; \
echo "[type: pod] $$f \$$lang:\$$lang/$$b" >> $@-t; \
echo >> $@-t; \
done;
mv $@-t $@
endif