[Po4a-commits] "po4a/share ChangeLog, NONE, 1.1 Makevars-perl.example, NONE, 1.1 Makevars-shell.example, NONE, 1.1 po4a-build, NONE, 1.1 po4a-build.make, NONE, 1.1"

Neil Williams codehelp at alioth.debian.org
Fri Nov 6 22:07:10 UTC 2009


Update of /cvsroot/po4a/po4a/share
In directory alioth:/tmp/cvs-serv10083

Added Files:
	ChangeLog Makevars-perl.example Makevars-shell.example 
	po4a-build po4a-build.make 
Log Message:
	* Makevars-perl.example: Example for perl packages.
	* Makevars-shell.example: Example for shell packages.
	* po/Makefile: Copy of po4a-build.make for our translations.
	* po/Makevars: Copy of Makevars-shell.example for po4a-build
	* po/POTFILES.in: po4a-build support.
	* po4a-build: main script to allow translation to be a one-stop
	process.
	* po4a-build.make: Based on autotools, allows preparation of
	POT files and updating of PO files for script output translation
	messages.



--- NEW FILE: ChangeLog ---
2009-11-06  Neil Williams  <linux at codehelp.co.uk>

	* Makevars-perl.example: Example for perl packages.
	* Makevars-shell.example: Example for shell packages.
	* po/Makefile: Copy of po4a-build.make for our translations.
	* po/Makevars: Copy of Makevars-shell.example for po4a-build
	* po/POTFILES.in: po4a-build support.
	* po4a-build: main script to allow translation to be a one-stop
	process.
	* po4a-build.make: Based on autotools, allows preparation of
	POT files and updating of PO files for script output translation
	messages.

--- NEW FILE: Makevars-shell.example ---
# Makefile variables for PO directory in any package using GNU gettext.

# Usually the message domain is the same as the package name.
DOMAIN = po4a

# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..

# These options get passed to xgettext.
XGETTEXT_OPTIONS = -L Shell --from-code=iso-8859-1

# 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 = Neil Williams

# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
#   in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
#   understood.
# - Strings which make invalid assumptions about notation of date, time or
#   money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = po4a at packages.debian.org

# 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 =

--- NEW FILE: po4a-build.make ---
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper at gnu.ai.mit.edu>
# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns at gmail.com>
#
# This file may be copied and used freely without restrictions.  It may
# be used in projects which are not available under a GNU Public License,
# but which still want to provide support for the GNU gettext functionality.
#
# - Modified by Owen Taylor <otaylor at redhat.com> to use GETTEXT_PACKAGE
#
# - Modified by Neil Williams <linux at codehelp.co.uk> for Debian native
#   packages and to not require autoconf

# this Makefile is due to be replaced by [type:xgettext] support in po4a.

GETTEXT_PACKAGE = $(shell grep "^DOMAIN" Makevars |cut -d '=' -f2|tr -d ' ')
SHELL = /bin/sh

srcdir = .
top_srcdir = ..
top_builddir = ..
subdir = po
prefix = /usr
mkdir_p = mkdir -p
INSTALL_DATA = install -m 0644
datadir = ${datarootdir}
datarootdir = ${prefix}/share
DATADIRNAME = share
itlocaledir = $(prefix)/$(DATADIRNAME)/locale
GMSGFMT = /usr/bin/msgfmt
MSGFMT = /usr/bin/msgfmt
XGETTEXT = /usr/bin/xgettext
INTLTOOL_UPDATE = /usr/bin/intltool-update
INTLTOOL_EXTRACT = /usr/bin/intltool-extract
MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
GENPOT   = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
ALL_LINGUAS = 
PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)
USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi)
USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
POTFILES = $(shell cat POTFILES.in|sed 's/\(.*\).*/..\/\1/'|tr -d ' ')
CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)

.SUFFIXES:
.SUFFIXES: .po .pox .gmo .mo .msg .cat

.po.pox:
	$(MAKE) $(GETTEXT_PACKAGE).pot
	$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox

.po.mo:
	$(MSGFMT) -o $@ $<

.po.gmo:
	file=`echo $* | sed 's,.*/,,'`.gmo \
	  && rm -f $$file && $(GMSGFMT) -o $$file $<

.po.cat:
	sed -f ../intl/po2msg.sed < $< > $*.msg \
	  && rm -f $@ && gencat $@ $*.msg

all: all-yes

all-yes: $(CATALOGS)
all-no:
pot: $(GETTEXT_PACKAGE).pot
$(GETTEXT_PACKAGE).pot: $(POTFILES)
	$(GENPOT)

# the install fallbacks are probably unnecessary, just the first case is used.
install: install-data
install-data: install-data-yes
install-data-no: all
install-data-yes: all
	linguas="$(USE_LINGUAS)"; \
	for lang in $$linguas; do \
	  dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
	  $(mkdir_p) $$dir; \
	  if test -r $$lang.gmo; then \
	    $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
	    echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
	  else \
	    $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
	    echo "installing $(srcdir)/$$lang.gmo as" \
		 "$$dir/$(GETTEXT_PACKAGE).mo"; \
	  fi; \
	  if test -r $$lang.gmo.m; then \
	    $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
	    echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
	  else \
	    if test -r $(srcdir)/$$lang.gmo.m ; then \
	      $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
		$$dir/$(GETTEXT_PACKAGE).mo.m; \
	      echo "installing $(srcdir)/$$lang.gmo.m as" \
		   "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
	    else \
	      true; \
	    fi; \
	  fi; \
	done

# Empty stubs to satisfy archaic automake needs
dvi info tags TAGS ID:

# Define this as empty until I found a useful application.
install-exec installcheck:

uninstall:

check: all $(GETTEXT_PACKAGE).pot
	rm -f missing notexist
	srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
	if [ -r missing -o -r notexist ]; then \
	  exit 1; \
	fi

mostlyclean:
	rm -f *.pox *.old.po cat-id-tbl.tmp
	rm -f .intltool-merge-cache

clean: mostlyclean

distclean: clean
	rm -f Makefile Makefile.in POTFILES stamp-it
	rm -f *.mo *.msg *.cat *.cat.m *.gmo $(GETTEXT_PACKAGE).pot

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 Makefile.in.in

Makefile POTFILES: 
	@if test ! -f $@; then \
	  rm -f stamp-it; \
	  $(MAKE) stamp-it; \
	fi

stamp-it: POTFILES.in

# 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:

--- NEW FILE: Makevars-perl.example ---
# Makefile variables for PO directory in any package using GNU gettext.

# Usually the message domain is the same as the package name.
DOMAIN = po4a

# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..

# These options get passed to xgettext.
XGETTEXT_OPTIONS = -L Perl --from-code=iso-8859-1

# 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 = Neil Williams

# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
#   in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
#   understood.
# - Strings which make invalid assumptions about notation of date, time or
#   money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = po4a at packages.debian.org

# 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 =

--- NEW FILE: po4a-build ---
#!/bin/sh
set -e

#  Copyright (C) 2006-2009  Neil Williams <codehelp at debian.org>
#
#  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 3 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, see <http://www.gnu.org/licenses/>.

# pull in /usr/bin/gettext.sh
. gettext.sh

TEXTDOMAIN="po4a"
export TEXTDOMAIN
# this DIR might need to be configurable.
TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAINDIR

# DEFAULTS:
# name and location of the config file
# relative to the top level source directory of the translations
# i.e. the directory containing ./po/
CONFIG="po4a.config"
# PODIR po directory for manpages/docs
PODIR="po"
# POTFILE path
POTFILE=""
# base directory for generated files, e.g. doc
BASEDIR=""
# the binary packages that will contain generated manpages
BINARIES=""
# the binary packages with manpages in Section 3.
HASMAN3=""
# the binary packages using DocBook XML & xsltproc
XMLPACKAGES=""
# the DocBook XML files (TODO: let this take paths)
XMLFILE=""
# the pattern to find the XML files
XMLDIR=""
# the pattern to find the .docbook files
DOCBOOKDIR=""
# the XSL file to use for Docbook XSL
XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
# the POD files (TODO: let this take paths)
PODFILE=""
# the binary packages using POD
PODPACKAGES=""
# html output (subdirectory of BASEDIR)
HTMLDIR=""
# html DocBook file
HTMLFILE=""
# the XSL file to use for Docbook XSL
HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"

# remember to add something to the clean:: rule in debian/rules
# to remove each binary package sub-directory.
# $(RM) -r doc/emdebian-rootfs doc/multistrap

# below this point, no changes should be needed.

# use a default manpages.cnf in the current directory.
FILE="manpages.conf"

wrap_langs () {
	if [ -z "$LANGS" ]; then
		echo "$1 $2" >> $CONFIG
	else
		echo "$1 $2 $3" >> $CONFIG
	fi
}

usagehelp () {
	# print out help message
	eval_gettext "
genmanpages - po4a frontend

Syntax: genmanpages
        genmanpages --pot-only

Commands:
-?|-h|--help|-version:      print this help message and exit
--pot-only:                 only create the POT file

Options:
-f|--file FILE:             manpages.conf config file path

"; echo
}

while [ -n "$1" ]; do
case "$1" in
	--help|-h|-\?|--version)
		echo usagehelp
		exit;
	;;
	--pot-only)
		POTONLY=1
		break;
	;;
	-f|--file)
		shift
		FILE=$1
		break;
	;;
	*)
		com=$1
		eval_gettext "Unrecognised command: \$com"; echo
	exit;
	;;
esac
done

if [ ! -f "debian/changelog" ]; then
	eval_gettext "genmanpages started from the wrong directory."; echo
	exit 2
fi

if [ ! -f "$FILE" ]; then
	# without config, there's nothing to do.
	eval_gettext "Cannot find config file! '\$FILE'"; echo
	exit 3
else
	. ./$FILE
fi

# calculate the langs, automatically.
LANGS=`ls $PODIR/*.po 2>/dev/null || true`
if [ ! -z "$LANGS" ]; then
	LANGS=`ls $PODIR/*.po | sed -e 's/.*\/\(.*\)\.po/\1 /' || true`
fi
if [ ! -z "$LANGS" ]; then
	LANGS=`echo $LANGS|tr -d '\n'`
	echo "[po4a_langs] $LANGS" > $CONFIG
	else
	echo > $CONFIG
fi
wrap_langs "[po4a_paths]" "$POTFILE" "\$lang:$PODIR/\$lang.po"

for file in $XMLDIR/*.xml; do
	LOCAL=`basename $file`
	wrap_langs "[type:docbook]" "$file" "\$lang:$XMLDIR/\$lang/$LOCAL"
done
for file in $DOCBOOKDIR; do
	LOCAL=`basename $file`
	wrap_langs "[type:docbook]" "$file" "\$lang:$BASEDIR/\$lang/$LOCAL"
done
if [ -n "$PODFILE" ]; then
	for file in "$PODFILE"; do
		wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/\$lang/$file"
	done
fi

if [ "$POTONLY" = "1" ]; then
	po4a --no-translations $CONFIG
	exit
fi

for d in $BINARIES; do
	for l in $LANGS; do
		mkdir -p $BASEDIR/$d/man/$l/man1/
		if [ "$d" = "$HASMAN3" ]; then
			mkdir -p $BASEDIR/$d/man/$l/man3/
		fi
		mkdir -p $BASEDIR/$d/$l/$HTMLDIR/
	done
	mkdir -p $BASEDIR/$d/man/man1/
	if [ "$d" = "$HASMAN3" ]; then
		mkdir -p $BASEDIR/$d/man/man3/
	fi
	mkdir -p $BASEDIR/pod/$l/
done

# use -k to create all XML even if untranslated or the XSL breaks the build.
po4a -k 0 $CONFIG

for d in $BINARIES; do
	for P in $XMLPACKAGES; do
		if [ $d = $P ]; then
			for X in $XMLFILE; do
				eval_gettext "Processing untranslated files for $d . . ."; echo
				XML_CATALOG_FILES="/etc/xml/catalog" \
				xsltproc -o $BASEDIR/$P/man/ --nonet $XSLFILE $XMLDIR/$X
				if [ "$d" = "$HASMAN3" ]; then
					mv $BASEDIR/$P/man/*.3 $BASEDIR/$P/man/man3/
				else
					rm -f $BASEDIR/$P/man/*.3
				fi
				mv $BASEDIR/$P/man/*.1 $BASEDIR/$P/man/man1/
			done
		fi
	done
	for POD in $PODPACKAGES; do
		if [ $d = "$POD" ]; then
			eval_gettext "Processing untranslated files for $POD . . ."; echo
			pod2man $PODFILE > $BASEDIR/$POD/man/man1/$PODFILE.1
		fi
	done
	if [ -n "$HTMLDIR" ]; then
		xsltproc -o $BASEDIR/$d/$HTMLDIR/ --nonet $HTMLXSL $XMLDIR/$HTMLFILE
	fi
	for l in $LANGS; do
		for P in $XMLPACKAGES; do
			if [ $d = "$P" ]; then
				eval_gettext "Processing $l translations for $d . . ."; echo
				for X in $XMLFILE; do
					XML_CATALOG_FILES="/etc/xml/catalog" \
					xsltproc -o $BASEDIR/$P/man/ --nonet $XSLFILE $XMLDIR/$l/$X
				done
				if [ "$d" = "$HASMAN3" ]; then
					mv $BASEDIR/$P/man/*.3 $BASEDIR/$P/man/$l/man3/
				else
					rm -f $BASEDIR/$P/man/*.3
				fi
				mv $BASEDIR/$P/man/*.1 $BASEDIR/$P/man/$l/man1/
			fi
		done
		for POD in $PODPACKAGES; do
			if [ $d = "$POD" ]; then
				eval_gettext "Processing $l translations for $POD . . ."; echo
				pod2man $BASEDIR/pod/$l/$PODFILE > $BASEDIR/$POD/man/$l/man1/$PODFILE.1
			fi
		done
		if [ -n "$HTMLDIR" ]; then
			mkdir -p $BASEDIR/$d/$HTMLDIR/$l/
			xsltproc -o $BASEDIR/$d/$HTMLDIR/$l/ --nonet $HTMLXSL $XMLDIR/$l/$HTMLFILE
		fi
		done
		if [ -n "$HTMLDIR" ]; then
			for i in `ls $BASEDIR/$d/$HTMLDIR/*.html`; do
				iconv -t utf-8 -f iso8859-1 $i > $BASEDIR/$HTMLDIR/tmp
				sed < $BASEDIR/$HTMLDIR/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'
			done
		fi
	if [ -n "$HTMLDIR" ]; then
		rm -f $BASEDIR/$HTMLDIR/tmp
	fi
done

for l in $LANGS; do
	rm -rf $XMLDIR/$l
done
rm -rf $BASEDIR/pod/




More information about the Po4a-commits mailing list