# PaCkAgE DaTaStReAm intltool 1 371 # end of header 07070100038c76000081a40000000000000000000000014c8079340000012b0000010000010036ffffffffffffffff0000001100000000intltool/pkginfoPKG=intltool NAME=intltool 0.41.1 SPARC 64bit Solaris 10 VERSION=0.41.1 PSTAMP=3rd September 2010 VENDOR=The intltool Project EMAIL=http://freedesktop.org/wiki/Software/intltool DESC=File format translation tool ARCH=sparc CATEGORY=utility CLASSES=none BASEDIR=/ ISTATES=S s 1 2 3 RSTATES=S s 1 2 3 07070100038c75000081a40000000000000000000000014c807934000005770000010000010036ffffffffffffffff0000001000000000intltool/pkgmap: 1 371 1 d none /usr ? ? ? 1 d none /usr/local ? ? ? 1 d none /usr/local/bin 0755 root root 1 f none /usr/local/bin/intltool-extract 0755 root root 28153 35589 1283488022 1 f none /usr/local/bin/intltool-merge 0755 root root 39354 61933 1283488022 1 f none /usr/local/bin/intltool-prepare 0755 root root 8602 18180 1283488022 1 f none /usr/local/bin/intltool-update 0755 root root 34071 38063 1283488022 1 f none /usr/local/bin/intltoolize 0755 root root 7162 55380 1283488022 1 d none /usr/local/share 0755 root root 1 d none /usr/local/share/aclocal 0755 root root 1 f none /usr/local/share/aclocal/intltool.m4 0644 root root 10381 7510 1283488022 1 d none /usr/local/share/intltool 0755 root root 1 f none /usr/local/share/intltool/Makefile.in.in 0644 root root 6911 2772 1283488022 1 d none /usr/local/share/man 0755 root root 1 d none /usr/local/share/man/man8 0755 root root 1 f none /usr/local/share/man/man8/intltool-extract.8 0644 root root 2020 37512 1283488022 1 f none /usr/local/share/man/man8/intltool-merge.8 0644 root root 2781 19528 1283488022 1 f none /usr/local/share/man/man8/intltool-prepare.8 0644 root root 2567 28682 1283488022 1 f none /usr/local/share/man/man8/intltool-update.8 0644 root root 3739 41905 1283488022 1 f none /usr/local/share/man/man8/intltoolize.8 0644 root root 1319 45334 1283488022 1 i checkinstall 785 2565 1283488052 1 i pkginfo 299 24136 1283488052 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!07070100038c76000081a40000000000000000000000014c8079340000012b0000010000010036ffffffffffffffff0000000800000000pkginfoPKG=intltool NAME=intltool 0.41.1 SPARC 64bit Solaris 10 VERSION=0.41.1 PSTAMP=3rd September 2010 VENDOR=The intltool Project EMAIL=http://freedesktop.org/wiki/Software/intltool DESC=File format translation tool ARCH=sparc CATEGORY=utility CLASSES=none BASEDIR=/ ISTATES=S s 1 2 3 RSTATES=S s 1 2 3 07070100038c75000081a40000000000000000000000014c807934000005770000010000010036ffffffffffffffff0000000700000000pkgmap: 1 371 1 d none /usr ? ? ? 1 d none /usr/local ? ? ? 1 d none /usr/local/bin 0755 root root 1 f none /usr/local/bin/intltool-extract 0755 root root 28153 35589 1283488022 1 f none /usr/local/bin/intltool-merge 0755 root root 39354 61933 1283488022 1 f none /usr/local/bin/intltool-prepare 0755 root root 8602 18180 1283488022 1 f none /usr/local/bin/intltool-update 0755 root root 34071 38063 1283488022 1 f none /usr/local/bin/intltoolize 0755 root root 7162 55380 1283488022 1 d none /usr/local/share 0755 root root 1 d none /usr/local/share/aclocal 0755 root root 1 f none /usr/local/share/aclocal/intltool.m4 0644 root root 10381 7510 1283488022 1 d none /usr/local/share/intltool 0755 root root 1 f none /usr/local/share/intltool/Makefile.in.in 0644 root root 6911 2772 1283488022 1 d none /usr/local/share/man 0755 root root 1 d none /usr/local/share/man/man8 0755 root root 1 f none /usr/local/share/man/man8/intltool-extract.8 0644 root root 2020 37512 1283488022 1 f none /usr/local/share/man/man8/intltool-merge.8 0644 root root 2781 19528 1283488022 1 f none /usr/local/share/man/man8/intltool-prepare.8 0644 root root 2567 28682 1283488022 1 f none /usr/local/share/man/man8/intltool-update.8 0644 root root 3739 41905 1283488022 1 f none /usr/local/share/man/man8/intltoolize.8 0644 root root 1319 45334 1283488022 1 i checkinstall 785 2565 1283488052 1 i pkginfo 299 24136 1283488052 07070100038c8c000041ed0000000000000000000000024c807934000000000000010000010036ffffffffffffffff0000000800000000install07070100038c8d000081ed0000000000000000000000014c807934000003110000010000010036ffffffffffffffff0000001500000000install/checkinstall#!/bin/sh # expected_bits="64" expected_release="5.10" expected_platform="sparc" # release=`uname -r` platform=`uname -p` bits=`isainfo -b` # if [ ${platform} != ${expected_platform} ]; then echo "\n\n\n\tThis package must be installed on a ${expected_platform} architecture\n" echo "\tAborting installation.\n\n\n" exit 1 fi if [ ${release} != ${expected_release} ]; then echo "\n\n\n\tThis package must be installed on a ${expected_release} machine\n" echo "\tAborting installation.\n\n\n" exit 1 fi if [ ${bits} != ${expected_bits} ]; then echo "\n\n\n\tThis package must be installed on a ${expected_bits} bit machine\n" echo "\tYour machine is running a ${bits} bit O.S. currently\n" echo "\tAborting installation.\n\n\n" exit 1 fi exit 0 07070100038c77000041ed0000000000000000000000034c807934000000000000010000010036ffffffffffffffff0000000500000000root07070100038c78000041ed0000000000000000000000034c807934000000000000010000010036ffffffffffffffff0000000900000000root/usr07070100038c79000041ed0000000000000000000000044c807934000000000000010000010036ffffffffffffffff0000000f00000000root/usr/local07070100038c80000041ed0000000000000000000000054c807934000000000000010000010036ffffffffffffffff0000001500000000root/usr/local/share07070100038c83000041ed0000000000000000000000024c807934000000000000010000010036ffffffffffffffff0000001e00000000root/usr/local/share/intltool07070100038c84000081a40000000000000000000000014c80791600001aff0000010000010036ffffffffffffffff0000002d00000000root/usr/local/share/intltool/Makefile.in.in# Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper # Copyright (C) 2004-2008 Rodney Dawes # # 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 to use GETTEXT_PACKAGE # instead of PACKAGE and to look for po2tbl in ./ not in intl/ # # - Modified by jacob berkman to install # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize # # - Modified by Rodney Dawes for use with intltool # # We have the following line for use by intltoolize: # INTLTOOL_MAKEFILE GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datadir = @datadir@ datarootdir = @datarootdir@ libdir = @libdir@ DATADIRNAME = @DATADIRNAME@ itlocaledir = $(prefix)/$(DATADIRNAME)/locale subdir = po install_sh = @install_sh@ # Automake >= 1.8 provides @mkdir_p@. # Until it can be supposed, use the safe fallback: mkdir_p = $(install_sh) -d INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ XGETTEXT = @XGETTEXT@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ INTLTOOL_EXTRACT = @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 = @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) DISTFILES = Makefile.in.in POTFILES.in $(POFILES) EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS POTFILES = \ # This comment gets stripped out 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-@USE_NLS@ all-yes: $(CATALOGS) all-no: $(GETTEXT_PACKAGE).pot: $(POTFILES) $(GENPOT) install: install-data install-data: install-data-@USE_NLS@ 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 ctags tags CTAGS TAGS ID: # Define this as empty until I found a useful application. install-exec installcheck: uninstall: linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \ done 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 $(GETTEXT_PACKAGE).pot *.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 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 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(DISTFILES) dists="$(DISTFILES)"; \ extra_dists="$(EXTRA_DISTFILES)"; \ for file in $$extra_dists; do \ test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \ done; \ for file in $$dists; do \ test -f $$file || file="$(srcdir)/$$file"; \ ln $$file $(distdir) 2> /dev/null \ || cp -p $$file $(distdir); \ done update-po: Makefile $(MAKE) $(GETTEXT_PACKAGE).pot tmpdir=`pwd`; \ linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ echo "$$lang:"; \ result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ if $$result; then \ if cmp $(srcdir)/$$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; \ rm -f $$tmpdir/$$lang.new.po; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$lang.gmo failed!"; \ rm -f $$tmpdir/$$lang.new.po; \ fi; \ done Makefile POTFILES: stamp-it @if test ! -f $@; then \ rm -f stamp-it; \ $(MAKE) stamp-it; \ fi stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ $(SHELL) ./config.status # 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: 07070100038c81000041ed0000000000000000000000024c807934000000000000010000010036ffffffffffffffff0000001d00000000root/usr/local/share/aclocal07070100038c82000081a40000000000000000000000014c8079160000288d0000010000010036ffffffffffffffff0000002900000000root/usr/local/share/aclocal/intltool.m4## intltool.m4 - Configure intltool for the target system. -*-Shell-script-*- ## Copyright (C) 2001 Eazel, Inc. ## Author: Maciej Stachowiak ## Kenneth Christiansen ## ## 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ## ## As a special exception to the GNU General Public License, if you ## distribute this file as part of a program that contains a ## configuration script generated by Autoconf, you may include it under ## the same distribution terms that you use for the rest of that program. dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) # serial 40 IT_PROG_INTLTOOL AC_DEFUN([IT_PROG_INTLTOOL], [ AC_PREREQ([2.50])dnl AC_REQUIRE([AM_NLS])dnl case "$am__api_version" in 1.[01234]) AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) ;; *) ;; esac if test -n "$1"; then AC_MSG_CHECKING([for intltool >= $1]) INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` ] AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) fi AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update]) AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge]) AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract]) if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.]) fi INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@' INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@' INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' _IT_SUBST(INTLTOOL_DESKTOP_RULE) _IT_SUBST(INTLTOOL_DIRECTORY_RULE) _IT_SUBST(INTLTOOL_KEYS_RULE) _IT_SUBST(INTLTOOL_PROP_RULE) _IT_SUBST(INTLTOOL_OAF_RULE) _IT_SUBST(INTLTOOL_PONG_RULE) _IT_SUBST(INTLTOOL_SERVER_RULE) _IT_SUBST(INTLTOOL_SHEET_RULE) _IT_SUBST(INTLTOOL_SOUNDLIST_RULE) _IT_SUBST(INTLTOOL_UI_RULE) _IT_SUBST(INTLTOOL_XAM_RULE) _IT_SUBST(INTLTOOL_KBD_RULE) _IT_SUBST(INTLTOOL_XML_RULE) _IT_SUBST(INTLTOOL_XML_NOMERGE_RULE) _IT_SUBST(INTLTOOL_CAVES_RULE) _IT_SUBST(INTLTOOL_SCHEMAS_RULE) _IT_SUBST(INTLTOOL_THEME_RULE) _IT_SUBST(INTLTOOL_SERVICE_RULE) _IT_SUBST(INTLTOOL_POLICY_RULE) # Check the gettext tools to make sure they are GNU AC_PATH_PROG(XGETTEXT, xgettext) AC_PATH_PROG(MSGMERGE, msgmerge) AC_PATH_PROG(MSGFMT, msgfmt) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) fi xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) fi AC_PATH_PROG(INTLTOOL_PERL, perl) if test -z "$INTLTOOL_PERL"; then AC_MSG_ERROR([perl not found]) fi AC_MSG_CHECKING([for perl >= 5.8.1]) $INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1 if test $? -ne 0; then AC_MSG_ERROR([perl 5.8.1 is required for intltool]) else IT_PERL_VERSION="`$INTLTOOL_PERL -e \"printf '%vd', $^V\"`" AC_MSG_RESULT([$IT_PERL_VERSION]) fi if test "x$2" != "xno-xml"; then AC_MSG_CHECKING([for XML::Parser]) if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then AC_MSG_RESULT([ok]) else AC_MSG_ERROR([XML::Parser perl module is required for intltool]) fi fi # Substitute ALL_LINGUAS so we can use it in po/Makefile AC_SUBST(ALL_LINGUAS) # Set DATADIRNAME correctly if it is not set yet # (copied from glib-gettext.m4) if test -z "$DATADIRNAME"; then AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr]])], [DATADIRNAME=share], [case $host in *-*-solaris*) dnl On Solaris, if bind_textdomain_codeset is in libc, dnl GNU format message catalog is always supported, dnl since both are added to the libc all together. dnl Hence, we'd like to go with DATADIRNAME=share dnl in this case. AC_CHECK_FUNC(bind_textdomain_codeset, [DATADIRNAME=share], [DATADIRNAME=lib]) ;; *) [DATADIRNAME=lib] ;; esac]) fi AC_SUBST(DATADIRNAME) IT_PO_SUBDIR([po]) ]) # IT_PO_SUBDIR(DIRNAME) # --------------------- # All po subdirs have to be declared with this macro; the subdir "po" is # declared by IT_PROG_INTLTOOL. # AC_DEFUN([IT_PO_SUBDIR], [AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. dnl dnl The following CONFIG_COMMANDS should be executed at the very end dnl of config.status. AC_CONFIG_COMMANDS_PRE([ AC_CONFIG_COMMANDS([$1/stamp-it], [ if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.]) fi rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" >"$1/stamp-it.tmp" [sed '/^#/d s/^[[].*] *// /^[ ]*$/d '"s|^| $ac_top_srcdir/|" \ "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" ] [sed '/^POTFILES =/,/[^\\]$/ { /^POTFILES =/!d r $1/POTFILES } ' "$1/Makefile.in" >"$1/Makefile"] rm -f "$1/Makefile.tmp" mv "$1/stamp-it.tmp" "$1/stamp-it" ]) ])dnl ]) # _IT_SUBST(VARIABLE) # ------------------- # Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST # AC_DEFUN([_IT_SUBST], [ AC_SUBST([$1]) m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) ] ) # deprecated macros AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) # A hint is needed for aclocal from Automake <= 1.9.4: # AC_DEFUN([AC_PROG_INTLTOOL], ...) 07070100038c85000041ed0000000000000000000000034c807934000000000000010000010036ffffffffffffffff0000001900000000root/usr/local/share/man07070100038c86000041ed0000000000000000000000024c807934000000000000010000010036ffffffffffffffff0000001e00000000root/usr/local/share/man/man807070100038c88000081a40000000000000000000000014c80791600000add0000010000010036ffffffffffffffff0000002f00000000root/usr/local/share/man/man8/intltool-merge.8.TH INTLTOOL-MERGE 8 "2003-08-02" "intltool" .SH NAME intltool-merge \- merge translated strings into various types of file .SH SYNOPSIS .B "intltool-merge" .I "[option]..." PO_DIRECTORY FILENAME OUTPUT_FILE .SH DESCRIPTION .PP Merge translated strings in po files in \fIPO_DIRECTORY\fR with the original application file \fIFILENAME\fR, and output the file \fIOUTPUT_FILE\fR containing both original and localized strings. .PP If \fIFILENAME\fR is an XML file, \fIOUTPUT_FILE\fR will contain repeated xml nodes, where each node contains one of the localized strings with "xml:lang" attribute. .SH OPTIONS .\" ------------------------------------------------------- .SS "Mode of operation" .\" ------------------------------------------------------- .IP "\fB\-b\fR" 4 .PD 0 .IP "\fB\--ba-style\fR" 4 .PD Merge files in bonobo-activation style, which is used for bonobo servers. .IP "\fB\-d\fR" 4 .PD 0 .IP "\fB\--desktop-style\fR" 4 .PD Merge files in desktop style, which is similar to the Windows .ini file format. .IP "\fB\-k\fR" 4 .PD 0 .IP "\fB\--keys-style\fR" 4 .PD Merge files in keys style, which is used for metadata. .IP "\fB\-o\fR" 4 .PD 0 .IP "\fB\--oaf-style\fR" 4 .PD (OBSOLETE) Same as .BR \-b / \--ba-style "." .IP "\fB\-r\fR" 4 .PD 0 .IP "\fB\--rfc822deb-style\fR" 4 .PD Merge files in RFC 822 style, which is usually used in Debian configuration files. .IP "\fB\--quoted-style\fR" 4 .PD Merge files in quoted string style, which just translates any strings within "". .IP "\fB\-x\fR" 4 .PD 0 .IP "\fB\--xml-style\fR" 4 .PD Merge files in standard XML style, both as attributes and as raw pcdata. .\" ------------------------------------------------------- .SS "Other options" .\" ------------------------------------------------------- .IP "\fB\-u\fR" 4 .PD 0 .IP "\fB\--utf8\fR" 4 .PD Convert all strings to UTF-8 before merging. .IP "\fB\-p\fR" 4 .PD 0 .IP "\fB\--pass-through\fR" 4 .PD Use strings as is in .po files without conversion (STRONGLY unrecommended with -x). .IP "\fB\-c\fR" 4 .PD 0 .IP "\fB\--cache\fR" 4 .PD (TBD) .IP "\fB\-q\fR" 4 .PD 0 .IP "\fB\--quiet\fR" 4 .PD Be quiet while running. .IP "\fB\-v\fR" 4 .PD 0 .IP "\fB\--version\fR" 4 .PD Show version information. .IP "\fB\-h\fR" 4 .PD 0 .IP "\fB\--help\fR" 4 .PD Show usage and basic help information. .SH FILES .IP "\fBpo/.intltool-merge-cache\fR" Cache file generated by \fBintltool-merge\fR, that contains all strings in all po files separated by \\01. .SH REPORTING BUGS Report bugs to http://bugs.launchpad.net/intltool .SH AUTHOR Darin Adler .br Kenneth Christiansen .br Maciej Stachowiak .SH SEE ALSO .BR iconv (1), .BR intltoolize (8), .BR intltool-prepare (8), .BR intltool-extract (8), .BR intltool-update (8) 07070100038c8b000081a40000000000000000000000014c807916000005270000010000010036ffffffffffffffff0000002c00000000root/usr/local/share/man/man8/intltoolize.8.TH INTLTOOLIZE 8 "2003-08-02" "intltool" .SH NAME intltoolize \- copy intltool related files to software package .SH SYNOPSIS .B intltoolize [\fIoption\fR]... .SH DESCRIPTION This prepares a package to use intltool by linking or copying various files needed by intltool into place for use when building. Note that you must change your working directory to the top level directory of the package before running .B intltoolize. .SH OPTIONS .IP "\fB\--automake\fR" 4 Work silently and assume that \fIautomake\fR is being used in software. .IP "\fB\-c\fR" 4 .PD 0 .IP "\fB\--copy\fR" 4 .PD Copy files rather than creating symbolic links to them. .IP "\fB\--debug\fR" 4 Enable verbose shell tracing. .IP "\fB\-n\fR" 4 .PD 0 .IP "\fB\--dry-run\fR" 4 .PD Print commands only, instead of executing them. .IP "\fB\-f\fR" 4 .PD 0 .IP "\fB\--force\fR" 4 .PD Replace existing files if they exist. .IP "\fB\-\-help\fR" 4 Show usage and basic help information. .IP "\fB\-\-version\fR" 4 Show version information. .SH REPORTING BUGS Report bugs to http://bugs.launchpad.net/intltool .SH AUTHOR Darin Adler .br Kenneth Christiansen .br Maciej Stachowiak .SH SEE ALSO .BR intltool-prepare (8), .BR intltool-extract (8), .BR intltool-merge (8), .BR intltool-update (8) 07070100038c89000081a40000000000000000000000014c80791600000a070000010000010036ffffffffffffffff0000003100000000root/usr/local/share/man/man8/intltool-prepare.8.TH INTLTOOL-PREPARE 8 "2003-08-02" "intltool" .SH NAME intltool-prepare \- Prepare software to make use of intltool .SH SYNOPSIS .B intltool-prepare [\fIoption\fR] [\fI\s-1KEYWORD\s0\fR]... .SH DESCRIPTION .PP For software packages that include some specific type of translatable files (such as .desktop and .soundlist), before they make use of \fBintltool\fR, translators have to dig through them one by one, and add their localization into each file. This process is error prone, since translators may include typing errors, or add their localization in wrong encoding. Besides, translators may not alwas know other files (beside .po files) are translatable. .PP .I intltool avoids all the problems above by extracting strings inside those translatable files into po template (.pot) file. All translators need to care about is just translating po files. Afterwards, \fBintltool-merge\fR(8) will merge localized strings into those files. .PP Before your software becomes intltool-aware, a few issues have to be sorted out, and \fBintltool-prepare\fR tries to take care of all of them. \fBintltool-prepare\fR will: .IP \[bu] 2 Extract all localized strings in .desktop style files (including ".desktop", ".soundlist", ".keys" and ".directory") into corresponding po files. .IP \[bu] Convert the translatable files into templates that don't contain any localization. .IP \[bu] Add the list of template files above into \fBPOTFILES.in\fR. .IP \[bu] Add the list of old translatable files into \fB.cvsignore\fR (since they will be generated by \fIintltool\fR later). .IP \[bu] Add the rules for generating these files into Makefile.am. .PP NOTE: You must change working directory to the top level source directory before running \fBintltool-prepare\fR. .SH OPTIONS .PP \fIKEYWORD\fR is a list of additional keywords beside "Name", "Comment" and "description". \fBintltool-prepare\fR will recognize any line starting with those \fIKEYWORD\fR and extract localized strings after equal sign ("="). .IP "\fB\-x\fR" 4 .PD 0 .IP "\fB\-\-verbose\fR" 4 .PD Be verbose to give user additional feedback. .IP "\fB\-v\fR" 4 .PD 0 .IP "\fB\-\-version\fR" 4 Show version information. .IP "\fB\-h\fR" 4 .PD 0 .IP "\fB\-\-help\fR" 4 Show usage and basic help information. .SH REPORTING BUGS Report bugs to http://bugs.launchpad.net/intltool .SH AUTHOR Darin Adler .br Kenneth Christiansen .br Maciej Stachowiak .SH SEE ALSO .BR intltoolize (8), .BR intltool-update (8), .BR intltool-extract (8), .BR intltool-merge (8) 07070100038c87000081a40000000000000000000000014c807916000007e40000010000010036ffffffffffffffff0000003100000000root/usr/local/share/man/man8/intltool-extract.8.TH INTLTOOL-EXTRACT 8 "2003-08-02" "intltool" .SH NAME intltool-extract \- generate header files which can be read by gettext .SH SYNOPSIS .B intltool-extract .I "[options]..." SOURCE_FILE .SH DESCRIPTION .B intltool-extract extracts strings in the specified XML/INI type \fISOURCE_FILE\fR and writes them into a C header file. Then \fBxgettext\fR(1) can merge these strings inside header file into po template. .B intltool-extract is usually not executed manually, but called from \fBintltool-update\fR(8) instead. .SH OPTIONS .IP "\fB\-l\fR" 4 .PD 0 .IP "\fB\--local\fR" 4 .PD Creates a subdirectory under current working directory (named "\fBtmp/\fR") and writes files there. This option can't be used with \fB\--update\fR option. .IP "\fB\--update\fR" 4 .PD Writes header file into the same directory the source file is in. New file name is the source file name appending ".h" extension. This option can't be used with .BR \-l / \--local option. Besides, this option is the default option if neither \fB\--local\fR nor \fB\--update\fR is specified. .IP "\fB\--type\fR=\fITYPE\fR" 4 .PD Specify the type of source file. Currently supported types are: .br "gettext/glade" (.glade, .glade2) .br "gettext/ini" (Generic INI file) .br "gettext/keys" (.keys) .br "gettext/rfc822deb" (RFC 822 format file) .br "gettext/quoted" (all strings within "") .br "gettext/schemas" (.schemas) .br "gettext/scheme" (.scm) .br "gettext/xml" (Generic XML file) .IP "\fB\-v\fR" 4 .PD 0 .IP "\fB\--version\fR" 4 .PD Show version information. .IP "\fB\-h\fR" 4 .PD 0 .IP "\fB\--help\fR" 4 .PD Show usage and basic help information. .IP "\fB\-q\fR" 4 .PD 0 .IP "\fB\--quiet\fR" 4 .PD Be quiet while running. .SH REPORTING BUGS Report bugs to http://bugs.launchpad.net/intltool .SH AUTHOR Darin Adler .br Kenneth Christiansen .br Maciej Stachowiak .SH SEE ALSO .BR intltoolize (8), .BR intltool-prepare (8), .BR intltool-merge (8), .BR intltool-update (8), .BR xgettext (1) 07070100038c8a000081a40000000000000000000000014c80791600000e9b0000010000010036ffffffffffffffff0000003000000000root/usr/local/share/man/man8/intltool-update.8.TH INTLTOOL-UPDATE 8 "2003-08-02" "intltool" .SH NAME intltool-update \- updates PO template file and merge translations with it .SH SYNOPSIS .BI intltool-update " [option]..." .br .BI intltool-update " LANGCODE" .SH DESCRIPTION .B intltool-update generates new po file templates from source code, and merges existing translations with these new po templates. .PP You must change working directory to the subdirectory containing translations (usually "\fIpo/\fR") before running \fBintltool-update\fR. .SH OPTIONS When executing .B intltool-update , only one mode of operation is allowed each time. .\" ------------------------------------------------------- .SS "Mode of operation" .\" ------------------------------------------------------- .IP "\fB\-p\fR" 4 .PD 0 .IP "\fB\-\-pot\fR" 4 .PD Generate po template (.pot) only. .IP "\fB\-s\fR" 4 .PD 0 .IP "\fB\-\-headers\fR" 4 .PD Executes \fBintltool-extract\fR(8) to extract strings inside XML/INI style files listed in \fBPOTFILES.in\fR, and writes the extracted strings into header files, so that the strings can be recognised by \fBxgettext\fR(1). .IP "\fB\-m\fR" 4 .PD 0 .IP "\fB\-\-maintain\fR" 4 .PD Search for left out files, which should have been listed in .B POTFILES.in or .BR POTFILES.skip "." A list of all these files are written into another file called "\fBmissing\fR". .IP "\fB\-r\fR" 4 .PD 0 .IP "\fB\-\-report\fR" 4 .PD Display a status report for all translations in the software. .IP "\fB\-d \fILANGCODE\fR" 4 .PD 0 .IP "\fB\-\-dist \fILANGCODE \fR" 4 .PD Merge .BR LANGCODE .po with existing PO template. .\" ------------------------------------------------------- .SS "Other options" .\" ------------------------------------------------------- . .IP "\fB\-g \fINAME\fR" 4 .PD 0 .IP "\fB\-\-gettext-package\fR=\fINAME\fR" 4 .PD Manually specify PO template file name, instead of determining the name automatically from source. Useful with .BR \-p / \-\-pot option. This option has an additional effect: the name of current working directory is no more limited to "po" or "po-*". .IP "\fB\-o \fIFILENAME\fR" 4 .PD 0 .IP "\fB\-\-output-file\fR=\fIFILENAME\fR" 4 .PD Manually specify output \fIFILENAME\fR after merging old translation with PO template. Useful either with .BR \-d / \-\-dist option or without any option. .IP "\fB\-x\fR" 4 .PD 0 .IP "\fB\-\-verbose\fR" 4 .PD Display lots of feedback. .IP "\fB\-\-version\fR" 4 Show version information. .IP "\fB\-\-help\fR" 4 Show usage and basic help information. .SH EXAMPLES Creates a new PO template from source code, and name it foo.pot: .PP .RS 2 .nf .ft CW .ne 1 intltool-update \-\-pot \-\-gettext\-package=foo .ft R .fi .RE .PP Updates translation file xy.po using existing po template called "bar.pot", and writes output into "xy1.po": .PP .RS 2 .nf .ft CW .ne 1 intltool-update --dist --gettext-package=bar --output-file=xy1.po xy .ft R .fi .RE .PP Creates new PO template and updates translation file xy.po (xy.po is overwritten with new content): .PP .RS 2 .nf .ft CW .ne 1 intltool-update xy .ft R .fi (same as \fBintltool-update --pot && intltool-update --dist xy\fR) .RE .SH FILES .IP "\fBpo/POTFILES.in\fR" Contains list of source files which contain translatable strings, one file per line. .IP "\fBpo/POTFILES.skip\fR" .PD 0 .IP "\fBpo/POTFILES.ignore\fR (obsolete)" .PD Contains list of source files which should be ignored when searching for translatable strings. .SH REPORTING BUGS Report bugs to http://bugs.launchpad.net/intltool .SH AUTHOR Darin Adler .br Kenneth Christiansen .br Maciej Stachowiak .SH SEE ALSO .BR intltoolize (8), .BR intltool-prepare (8), .BR intltool-extract (8), .BR intltool-merge (8), .BR xgettext (1) 07070100038c7a000041ed0000000000000000000000024c807934000000000000010000010036ffffffffffffffff0000001300000000root/usr/local/bin07070100038c7c000081ed0000000000000000000000014c807916000099ba0000010000010036ffffffffffffffff0000002200000000root/usr/local/bin/intltool-merge#!//bin/perl -w # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- # # The Intltool Message Merger # # Copyright (C) 2000, 2003 Free Software Foundation. # Copyright (C) 2000, 2001 Eazel, Inc # # Intltool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # version 2 published by the Free Software Foundation. # # Intltool 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # # Authors: Maciej Stachowiak # Kenneth Christiansen # Darin Adler # # Proper XML UTF-8'ification written by Cyrille Chepelov # ## Release information my $PROGRAM = "intltool-merge"; my $PACKAGE = "intltool"; my $VERSION = "0.41.1"; ## Loaded modules use strict; use Getopt::Long; use Text::Wrap; use File::Basename; use Encode; my $must_end_tag = -1; my $last_depth = -1; my $translation_depth = -1; my @tag_stack = (); my @entered_tag = (); my @translation_strings = (); my $leading_space = ""; ## Scalars used by the option stuff my $HELP_ARG = 0; my $VERSION_ARG = 0; my $BA_STYLE_ARG = 0; my $XML_STYLE_ARG = 0; my $KEYS_STYLE_ARG = 0; my $DESKTOP_STYLE_ARG = 0; my $SCHEMAS_STYLE_ARG = 0; my $RFC822DEB_STYLE_ARG = 0; my $QUOTED_STYLE_ARG = 0; my $QUOTEDXML_STYLE_ARG = 0; my $QUIET_ARG = 0; my $PASS_THROUGH_ARG = 0; my $UTF8_ARG = 0; my $MULTIPLE_OUTPUT = 0; my $cache_file; ## Handle options GetOptions ( "help" => \$HELP_ARG, "version" => \$VERSION_ARG, "quiet|q" => \$QUIET_ARG, "oaf-style|o" => \$BA_STYLE_ARG, ## for compatibility "ba-style|b" => \$BA_STYLE_ARG, "xml-style|x" => \$XML_STYLE_ARG, "keys-style|k" => \$KEYS_STYLE_ARG, "desktop-style|d" => \$DESKTOP_STYLE_ARG, "schemas-style|s" => \$SCHEMAS_STYLE_ARG, "rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG, "quoted-style" => \$QUOTED_STYLE_ARG, "quotedxml-style" => \$QUOTEDXML_STYLE_ARG, "pass-through|p" => \$PASS_THROUGH_ARG, "utf8|u" => \$UTF8_ARG, "multiple-output|m" => \$MULTIPLE_OUTPUT, "cache|c=s" => \$cache_file ) or &error; my $PO_DIR; my $FILE; my $OUTFILE; my %po_files_by_lang = (); my %translations = (); # Use this instead of \w for XML files to handle more possible characters. my $w = "[-A-Za-z0-9._:]"; # XML quoted string contents my $q = "[^\\\"]*"; ## Check for options. if ($VERSION_ARG) { &print_version; } elsif ($HELP_ARG) { &print_help; } elsif ($BA_STYLE_ARG && @ARGV > 2) { &utf8_sanity_check; &preparation; &print_message; &ba_merge_translations; &finalize; } elsif ($XML_STYLE_ARG && @ARGV > 2) { &utf8_sanity_check; &preparation; &print_message; &xml_merge_output; &finalize; } elsif ($KEYS_STYLE_ARG && @ARGV > 2) { &utf8_sanity_check; &preparation; &print_message; &keys_merge_translations; &finalize; } elsif ($DESKTOP_STYLE_ARG && @ARGV > 2) { &utf8_sanity_check; &preparation; &print_message; &desktop_merge_translations; &finalize; } elsif ($SCHEMAS_STYLE_ARG && @ARGV > 2) { &utf8_sanity_check; &preparation; &print_message; &schemas_merge_translations; &finalize; } elsif ($RFC822DEB_STYLE_ARG && @ARGV > 2) { &preparation; &print_message; &rfc822deb_merge_translations; &finalize; } elsif (($QUOTED_STYLE_ARG || $QUOTEDXML_STYLE_ARG) && @ARGV > 2) { &utf8_sanity_check; &preparation; &print_message; "ed_merge_translations($QUOTEDXML_STYLE_ARG); &finalize; } else { &print_help; } exit; ## Sub for printing release information sub print_version { print <<_EOF_; ${PROGRAM} (${PACKAGE}) ${VERSION} Written by Maciej Stachowiak, Darin Adler and Kenneth Christiansen. Copyright (C) 2000-2003 Free Software Foundation, Inc. Copyright (C) 2000-2001 Eazel, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. _EOF_ exit; } ## Sub for printing usage information sub print_help { print <<_EOF_; Usage: ${PROGRAM} [OPTION]... PO_DIRECTORY FILENAME OUTPUT_FILE Generates an output file that includes some localized attributes from an untranslated source file. Mandatory options: (exactly one must be specified) -b, --ba-style includes translations in the bonobo-activation style -d, --desktop-style includes translations in the desktop style -k, --keys-style includes translations in the keys style -s, --schemas-style includes translations in the schemas style -r, --rfc822deb-style includes translations in the RFC822 style --quoted-style includes translations in the quoted string style --quotedxml-style includes translations in the quoted xml string style -x, --xml-style includes translations in the standard xml style Other options: -u, --utf8 convert all strings to UTF-8 before merging (default for everything except RFC822 style) -p, --pass-through deprecated, does nothing and issues a warning -m, --multiple-output output one localized file per locale, instead of a single file containing all localized elements -c, --cache=FILE specify cache file name (usually \$top_builddir/po/.intltool-merge-cache) -q, --quiet suppress most messages --help display this help and exit --version output version information and exit Report bugs to http://bugs.launchpad.net/intltool _EOF_ exit; } ## Sub for printing error messages sub print_error { print STDERR "Try `${PROGRAM} --help' for more information.\n"; exit; } sub print_message { print "Merging translations into $OUTFILE.\n" unless $QUIET_ARG; } sub preparation { $PO_DIR = $ARGV[0]; $FILE = $ARGV[1]; $OUTFILE = $ARGV[2]; &gather_po_files; &get_translation_database; } # General-purpose code for looking up translations in .po files sub po_file2lang { my ($tmp) = @_; $tmp =~ s/^.*\/(.*)\.po$/$1/; return $tmp; } sub gather_po_files { if (my $linguas = $ENV{"LINGUAS"}) { for my $lang (split / /, $linguas) { my $po_file = $PO_DIR . "/" . $lang . ".po"; if (-e $po_file) { $po_files_by_lang{$lang} = $po_file; } } } else { if (open LINGUAS_FILE, "$PO_DIR/LINGUAS") { while () { next if /^#/; for my $lang (split) { chomp ($lang); my $po_file = $PO_DIR . "/" . $lang . ".po"; if (-e $po_file) { $po_files_by_lang{$lang} = $po_file; } } } close LINGUAS_FILE; } else { for my $po_file (glob "$PO_DIR/*.po") { $po_files_by_lang{po_file2lang($po_file)} = $po_file; } } } } sub get_po_encoding { my ($in_po_file) = @_; my $encoding = ""; open IN_PO_FILE, $in_po_file or die; while () { ## example: "Content-Type: text/plain; charset=ISO-8859-1\n" if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/) { $encoding = $1; last; } } close IN_PO_FILE; if (!$encoding) { print STDERR "Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n" unless $QUIET_ARG; $encoding = "ISO-8859-1"; } return $encoding } sub utf8_sanity_check { print STDERR "Warning: option --pass-through has been removed.\n" if $PASS_THROUGH_ARG; $UTF8_ARG = 1; } sub get_translation_database { if ($cache_file) { &get_cached_translation_database; } else { &create_translation_database; } } sub get_newest_po_age { my $newest_age; foreach my $file (values %po_files_by_lang) { my $file_age = -M $file; $newest_age = $file_age if !$newest_age || $file_age < $newest_age; } $newest_age = 0 if !$newest_age; return $newest_age; } sub create_cache { print "Generating and caching the translation database\n" unless $QUIET_ARG; &create_translation_database; open CACHE, ">$cache_file" || die; print CACHE join "\x01", %translations; close CACHE; } sub load_cache { print "Found cached translation database\n" unless $QUIET_ARG; my $contents; open CACHE, "<$cache_file" || die; { local $/; $contents = ; } close CACHE; %translations = split "\x01", $contents; } sub get_cached_translation_database { my $cache_file_age = -M $cache_file; if (defined $cache_file_age) { if ($cache_file_age <= &get_newest_po_age) { &load_cache; return; } print "Found too-old cached translation database\n" unless $QUIET_ARG; } &create_cache; } sub add_translation { my ($lang, $encoding, $msgctxt, $msgid, $msgstr) = @_; return if !($msgid && $msgstr); if ($msgctxt) { $msgid = "$msgctxt\004$msgid"; } if (uc $encoding ne "UTF-8") { Encode::from_to ($msgid, $encoding, "UTF-8"); Encode::from_to ($msgstr, $encoding, "UTF-8"); } $translations{$lang, $msgid} = $msgstr; } sub create_translation_database { for my $lang (keys %po_files_by_lang) { my $po_file = $po_files_by_lang{$lang}; my $encoding = "UTF-8"; if ($UTF8_ARG) { $encoding = get_po_encoding ($po_file); if (uc $encoding ne "UTF-8") { print "NOTICE: $po_file is not in UTF-8 but $encoding, converting...\n" unless $QUIET_ARG;; } } open PO_FILE, "<$po_file"; my $nextfuzzy = 0; my $inmsgctxt = 0; my $inmsgid = 0; my $inmsgstr = 0; my $msgctxt = ""; my $msgid = ""; my $msgstr = ""; while () { $nextfuzzy = 1 if /^#, fuzzy/; if (/^msgctxt "((\\.|[^\\]+)*)"/ ) { if ($inmsgstr) { add_translation ($lang, $encoding, $msgctxt, $msgid, $msgstr); $msgctxt = ""; $msgid = ""; $msgstr = ""; } $msgctxt = unescape_po_string($1); $inmsgctxt = 1; $inmsgid = 0; $inmsgstr = 0; } if (/^msgid "((\\.|[^\\]+)*)"/ ) { if ($inmsgstr) { add_translation ($lang, $encoding, $msgctxt, $msgid, $msgstr); $msgctxt = ""; $msgid = ""; $msgstr = ""; } if ($nextfuzzy) { $inmsgid = 0; $nextfuzzy = 0; } else { $msgid = unescape_po_string($1); $inmsgid = 1; } $inmsgctxt = 0; $inmsgstr = 0; } if (/^msgstr "((\\.|[^\\]+)*)"/) { $msgstr = unescape_po_string($1); $inmsgstr = 1; $inmsgctxt = 0; $inmsgid = 0; } if (/^"((\\.|[^\\]+)*)"/) { $msgctxt .= unescape_po_string($1) if $inmsgctxt; $msgid .= unescape_po_string($1) if $inmsgid; $msgstr .= unescape_po_string($1) if $inmsgstr; } } add_translation ($lang, $encoding, $msgctxt, $msgid, $msgstr) if ($inmsgstr); } } sub finalize { } sub unescape_one_sequence { my ($sequence) = @_; return "\\" if $sequence eq "\\\\"; return "\"" if $sequence eq "\\\""; return "\n" if $sequence eq "\\n"; return "\r" if $sequence eq "\\r"; return "\t" if $sequence eq "\\t"; return "\b" if $sequence eq "\\b"; return "\f" if $sequence eq "\\f"; return "\a" if $sequence eq "\\a"; return chr(11) if $sequence eq "\\v"; # vertical tab, see ascii(7) return chr(hex($1)) if ($sequence =~ /\\x([0-9a-fA-F]{2})/); return chr(oct($1)) if ($sequence =~ /\\([0-7]{3})/); # FIXME: Is \0 supported as well? Kenneth and Rodney don't want it, see bug #48489 return $sequence; } sub unescape_po_string { my ($string) = @_; $string =~ s/(\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\.)/unescape_one_sequence($1)/eg; return $string; } sub entity_decode { local ($_) = @_; s/'/'/g; # ' s/"/"/g; # " s/<//g; s/&/&/g; return $_; } # entity_encode: (string) # # Encode the given string to XML format (encode '<' etc). sub entity_encode { my ($pre_encoded) = @_; my @list_of_chars = unpack ('C*', $pre_encoded); # with UTF-8 we only encode minimalistic return join ('', map (&entity_encode_int_minimalist, @list_of_chars)); } sub entity_encode_int_minimalist { return """ if $_ == 34; return "&" if $_ == 38; return "'" if $_ == 39; return "<" if $_ == 60; return ">" if $_ == 62; return chr $_; } sub entity_encoded_translation { my ($lang, $string) = @_; my $translation = $translations{$lang, $string}; return $string if !$translation; return entity_encode ($translation); } ## XML (bonobo-activation specific) merge code sub ba_merge_translations { my $source; { local $/; # slurp mode open INPUT, "<$FILE" or die "can't open $FILE: $!"; $source = ; close INPUT; } open OUTPUT, ">$OUTFILE" or die "can't open $OUTFILE: $!"; # Binmode so that selftest works ok if using a native Win32 Perl... binmode (OUTPUT) if $^O eq 'MSWin32'; while ($source =~ s|^(.*?)([ \t]*<\s*$w+\s+($w+\s*=\s*"$q"\s*)+/?>)([ \t]*\n)?||s) { print OUTPUT $1; my $node = $2 . "\n"; my @strings = (); $_ = $node; while (s/(\s)_($w+\s*=\s*"($q)")/$1$2/s) { push @strings, entity_decode($3); } print OUTPUT; my %langs; for my $string (@strings) { for my $lang (keys %po_files_by_lang) { $langs{$lang} = 1 if $translations{$lang, $string}; } } for my $lang (sort keys %langs) { $_ = $node; s/(\sname\s*=\s*)"($q)"/$1"$2-$lang"/s; s/(\s)_($w+\s*=\s*")($q)"/$1 . $2 . entity_encoded_translation($lang, $3) . '"'/seg; print OUTPUT; } } print OUTPUT $source; close OUTPUT; } ## XML (non-bonobo-activation) merge code # Process tag attributes # Only parameter is a HASH containing attributes -> values mapping sub getAttributeString { my $sub = shift; my $do_translate = shift || 0; my $language = shift || ""; my $result = ""; my $translate = shift; foreach my $e (reverse(sort(keys %{ $sub }))) { my $key = $e; my $string = $sub->{$e}; my $quote = '"'; $string =~ s/^[\s]+//; $string =~ s/[\s]+$//; if ($string =~ /^'.*'$/) { $quote = "'"; } $string =~ s/^['"]//g; $string =~ s/['"]$//g; if ($do_translate && $key =~ /^_/) { $key =~ s|^_||g; if ($language) { # Handle translation my $decode_string = entity_decode($string); my $translation = $translations{$language, $decode_string}; if ($translation) { $translation = entity_encode($translation); $string = $translation; } $$translate = 2; } else { $$translate = 2 if ($translate && (!$$translate)); # watch not to "overwrite" $translate } } $result .= " $key=$quote$string$quote"; } return $result; } # Returns a translatable string from XML node, it works on contents of every node in XML::Parser tree sub getXMLstring { my $ref = shift; my $spacepreserve = shift || 0; my @list = @{ $ref }; my $result = ""; my $count = scalar(@list); my $attrs = $list[0]; my $index = 1; $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); while ($index < $count) { my $type = $list[$index]; my $content = $list[$index+1]; if (! $type ) { # We've got CDATA if ($content) { # lets strip the whitespace here, and *ONLY* here $content =~ s/\s+/ /gs if (!$spacepreserve); $result .= $content; } } elsif ( "$type" ne "1" ) { # We've got another element $result .= "<$type"; $result .= getAttributeString(@{$content}[0], 0); # no nested translatable elements if ($content) { my $subresult = getXMLstring($content, $spacepreserve); if ($subresult) { $result .= ">".$subresult . ""; } else { $result .= "/>"; } } else { $result .= "/>"; } } $index += 2; } return $result; } # Translate list of nodes if necessary sub translate_subnodes { my $fh = shift; my $content = shift; my $language = shift || ""; my $singlelang = shift || 0; my $spacepreserve = shift || 0; my @nodes = @{ $content }; my $count = scalar(@nodes); my $index = 0; while ($index < $count) { my $type = $nodes[$index]; my $rest = $nodes[$index+1]; if ($singlelang) { my $oldMO = $MULTIPLE_OUTPUT; $MULTIPLE_OUTPUT = 1; traverse($fh, $type, $rest, $language, $spacepreserve); $MULTIPLE_OUTPUT = $oldMO; } else { traverse($fh, $type, $rest, $language, $spacepreserve); } $index += 2; } } sub isWellFormedXmlFragment { my $ret = eval 'require XML::Parser'; if(!$ret) { die "You must have XML::Parser installed to run $0\n\n"; } my $fragment = shift; return 0 if (!$fragment); $fragment = "$fragment"; my $xp = new XML::Parser(Style => 'Tree'); my $tree = 0; eval { $tree = $xp->parse($fragment); }; return $tree; } sub traverse { my $fh = shift; my $nodename = shift; my $content = shift; my $language = shift || ""; my $spacepreserve = shift || 0; if (!$nodename) { if ($content =~ /^[\s]*$/) { $leading_space .= $content; } print $fh $content; } else { # element my @all = @{ $content }; my $attrs = shift @all; my $translate = 0; my $outattr = getAttributeString($attrs, 1, $language, \$translate); if ($nodename =~ /^_/) { $translate = 1; $nodename =~ s/^_//; } my $lookup = ''; $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); print $fh "<$nodename", $outattr; if ($translate) { $content = getXMLstring($content, $spacepreserve); if (!$spacepreserve) { $content =~ s/^\s+//s; $content =~ s/\s+$//s; } if (exists $attrs->{"msgctxt"}) { my $context = entity_decode ($attrs->{"msgctxt"}); $context =~ s/^["'](.*)["']/$1/; $lookup = "$context\004$content"; } else { $lookup = $content; } if ($lookup || $translate == 2) { my $translation = $translations{$language, $lookup} if isWellFormedXmlFragment($translations{$language, $lookup}); if ($MULTIPLE_OUTPUT && ($translation || $translate == 2)) { $translation = $content if (!$translation); print $fh " xml:lang=\"", $language, "\"" if $language; print $fh ">"; if ($translate == 2) { translate_subnodes($fh, \@all, $language, 1, $spacepreserve); } else { print $fh $translation; } print $fh ""; return; # this means there will be no same translation with xml:lang="$language"... # if we want them both, just remove this "return" } else { print $fh ">"; if ($translate == 2) { translate_subnodes($fh, \@all, $language, 1, $spacepreserve); } else { print $fh $content; } print $fh ""; } } else { print $fh "/>"; } for my $lang (sort keys %po_files_by_lang) { if ($MULTIPLE_OUTPUT && $lang ne "$language") { next; } if ($lang) { # Handle translation # my $translate = 0; my $localattrs = getAttributeString($attrs, 1, $lang, \$translate); my $translation = $translations{$lang, $lookup} if isWellFormedXmlFragment($translations{$lang, $lookup}); if ($translate && !$translation) { $translation = $content; } if ($translation || $translate) { print $fh "\n"; $leading_space =~ s/.*\n//g; print $fh $leading_space; print $fh "<", $nodename, " xml:lang=\"", $lang, "\"", $localattrs, ">"; if ($translate == 2) { translate_subnodes($fh, \@all, $lang, 1, $spacepreserve); } else { print $fh $translation; } print $fh ""; } } } } else { my $count = scalar(@all); if ($count > 0) { print $fh ">"; my $index = 0; while ($index < $count) { my $type = $all[$index]; my $rest = $all[$index+1]; traverse($fh, $type, $rest, $language, $spacepreserve); $index += 2; } print $fh ""; } else { print $fh "/>"; } } } } sub intltool_tree_comment { my $expat = shift; my $data = shift; my $clist = $expat->{Curlist}; my $pos = $#$clist; push @$clist, 1 => $data; } sub intltool_tree_cdatastart { my $expat = shift; my $clist = $expat->{Curlist}; my $pos = $#$clist; push @$clist, 0 => $expat->original_string(); } sub intltool_tree_cdataend { my $expat = shift; my $clist = $expat->{Curlist}; my $pos = $#$clist; $clist->[$pos] .= $expat->original_string(); } sub intltool_tree_char { my $expat = shift; my $text = shift; my $clist = $expat->{Curlist}; my $pos = $#$clist; # Use original_string so that we retain escaped entities # in CDATA sections. # if ($pos > 0 and $clist->[$pos - 1] eq '0') { $clist->[$pos] .= $expat->original_string(); } else { push @$clist, 0 => $expat->original_string(); } } sub intltool_tree_start { my $expat = shift; my $tag = shift; my @origlist = (); # Use original_string so that we retain escaped entities # in attribute values. We must convert the string to an # @origlist array to conform to the structure of the Tree # Style. # my @original_array = split /\x/, $expat->original_string(); my $source = $expat->original_string(); # Remove leading tag. # $source =~ s|^\s*<\s*(\S+)||s; # Grab attribute key/value pairs and push onto @origlist array. # while ($source) { if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/) { $source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s; push @origlist, $1; push @origlist, '"' . $2 . '"'; } elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/) { $source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s; push @origlist, $1; push @origlist, "'" . $2 . "'"; } else { last; } } my $ol = [ { @origlist } ]; push @{ $expat->{Lists} }, $expat->{Curlist}; push @{ $expat->{Curlist} }, $tag => $ol; $expat->{Curlist} = $ol; } sub readXml { my $filename = shift || return; if(!-f $filename) { die "ERROR Cannot find filename: $filename\n"; } my $ret = eval 'require XML::Parser'; if(!$ret) { die "You must have XML::Parser installed to run $0\n\n"; } my $xp = new XML::Parser(Style => 'Tree'); $xp->setHandlers(Char => \&intltool_tree_char); $xp->setHandlers(Start => \&intltool_tree_start); $xp->setHandlers(CdataStart => \&intltool_tree_cdatastart); $xp->setHandlers(CdataEnd => \&intltool_tree_cdataend); my $tree = $xp->parsefile($filename); # Hello thereHowdydo # would be: # [foo, [{}, head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar, [{}, # 0, "Howdy", ref, [{}]], 0, "do" ] ] return $tree; } sub print_header { my $infile = shift; my $fh = shift; my $source; if(!-f $infile) { die "ERROR Cannot find filename: $infile\n"; } print $fh qq{\n}; { local $/; open DOCINPUT, "<${FILE}" or die; $source = ; close DOCINPUT; } if ($source =~ /()/s) { print $fh "$1\n"; } elsif ($source =~ /(]*>)/s) { print $fh "$1\n"; } } sub parseTree { my $fh = shift; my $ref = shift; my $language = shift || ""; my $name = shift @{ $ref }; my $cont = shift @{ $ref }; while (!$name || "$name" eq "1") { $name = shift @{ $ref }; $cont = shift @{ $ref }; } my $spacepreserve = 0; my $attrs = @{$cont}[0]; $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); traverse($fh, $name, $cont, $language, $spacepreserve); } sub xml_merge_output { my $source; if ($MULTIPLE_OUTPUT) { for my $lang (sort keys %po_files_by_lang) { if ( ! -d $lang ) { mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; } open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; binmode (OUTPUT) if $^O eq 'MSWin32'; my $tree = readXml($FILE); print_header($FILE, \*OUTPUT); parseTree(\*OUTPUT, $tree, $lang); close OUTPUT; print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG; } if ( ! -d "C" ) { mkdir "C" or -d "C" or die "Cannot create subdirectory C: $!\n"; } open OUTPUT, ">C/$OUTFILE" or die "Cannot open C/$OUTFILE: $!\n"; binmode (OUTPUT) if $^O eq 'MSWin32'; my $tree = readXml($FILE); print_header($FILE, \*OUTPUT); parseTree(\*OUTPUT, $tree); close OUTPUT; print "CREATED C/$OUTFILE\n" unless $QUIET_ARG; } else { open OUTPUT, ">$OUTFILE" or die "Cannot open $OUTFILE: $!\n"; binmode (OUTPUT) if $^O eq 'MSWin32'; my $tree = readXml($FILE); print_header($FILE, \*OUTPUT); parseTree(\*OUTPUT, $tree); close OUTPUT; print "CREATED $OUTFILE\n" unless $QUIET_ARG; } } sub keys_merge_translation { my ($lang) = @_; if ( ! -d $lang && $MULTIPLE_OUTPUT) { mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; } open INPUT, "<${FILE}" or die "Cannot open ${FILE}: $!\n"; open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; binmode (OUTPUT) if $^O eq 'MSWin32'; while () { if (s/^(\s*)_(\w+=(.*))/$1$2/) { my $string = $3; if (!$MULTIPLE_OUTPUT) { print OUTPUT; my $non_translated_line = $_; for my $lang (sort keys %po_files_by_lang) { my $translation = $translations{$lang, $string}; next if !$translation; $_ = $non_translated_line; s/(\w+)=.*/[$lang]$1=$translation/; print OUTPUT; } } else { my $non_translated_line = $_; my $translation = $translations{$lang, $string}; $translation = $string if !$translation; $_ = $non_translated_line; s/(\w+)=.*/$1=$translation/; print OUTPUT; } } else { print OUTPUT; } } close OUTPUT; close INPUT; print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG; } sub keys_merge_translations { if ($MULTIPLE_OUTPUT) { for my $lang (sort keys %po_files_by_lang) { keys_merge_translation ($lang); } keys_merge_translation ("C"); } else { keys_merge_translation ("."); } } sub desktop_merge_translations { open INPUT, "<${FILE}" or die; open OUTPUT, ">${OUTFILE}" or die; binmode (OUTPUT) if $^O eq 'MSWin32'; while () { if (s/^(\s*)_([A-Za-z0-9\-]+=(.*))/$1$2/) { my $string = $3; print OUTPUT; my $non_translated_line = $_; for my $lang (sort keys %po_files_by_lang) { my $translation = $translations{$lang, $string}; next if !$translation; $_ = $non_translated_line; s/(\w+)=.*/${1}[$lang]=$translation/; print OUTPUT; } } else { print OUTPUT; } } close OUTPUT; close INPUT; } sub schemas_merge_translations { my $source; { local $/; # slurp mode open INPUT, "<$FILE" or die "can't open $FILE: $!"; $source = ; close INPUT; } open OUTPUT, ">$OUTFILE" or die; binmode (OUTPUT) if $^O eq 'MSWin32'; # FIXME: support attribute translations # Empty nodes never need translation, so unmark all of them. # For example, <_foo/> is just replaced by . $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; while ($source =~ s/ (.*?) (\s+)((\s*) (\s*(?:\s*)?(.*?)\s*<\/default>)?(\s*) (\s*(?:\s*)?(.*?)\s*<\/short>)?(\s*) (\s*(?:\s*)?(.*?)\s*<\/long>)?(\s*) <\/locale>) //sx) { print OUTPUT $1; my $locale_start_spaces = $2 ? $2 : ''; my $default_spaces = $4 ? $4 : ''; my $short_spaces = $7 ? $7 : ''; my $long_spaces = $10 ? $10 : ''; my $locale_end_spaces = $13 ? $13 : ''; my $c_default_block = $3 ? $3 : ''; my $default_string = $6 ? $6 : ''; my $short_string = $9 ? $9 : ''; my $long_string = $12 ? $12 : ''; print OUTPUT "$locale_start_spaces$c_default_block"; $default_string =~ s/\s+/ /g; $default_string = entity_decode($default_string); $short_string =~ s/\s+/ /g; $short_string = entity_decode($short_string); $long_string =~ s/\s+/ /g; $long_string = entity_decode($long_string); for my $lang (sort keys %po_files_by_lang) { my $default_translation = $translations{$lang, $default_string}; my $short_translation = $translations{$lang, $short_string}; my $long_translation = $translations{$lang, $long_string}; next if (!$default_translation && !$short_translation && !$long_translation); print OUTPUT "\n$locale_start_spaces"; print OUTPUT "$default_spaces"; if ($default_translation) { $default_translation = entity_encode($default_translation); print OUTPUT "$default_translation"; } print OUTPUT "$short_spaces"; if ($short_translation) { $short_translation = entity_encode($short_translation); print OUTPUT "$short_translation"; } print OUTPUT "$long_spaces"; if ($long_translation) { $long_translation = entity_encode($long_translation); print OUTPUT "$long_translation"; } print OUTPUT "$locale_end_spaces"; } } print OUTPUT $source; close OUTPUT; } sub rfc822deb_merge_translations { my %encodings = (); for my $lang (keys %po_files_by_lang) { $encodings{$lang} = ($UTF8_ARG ? 'UTF-8' : get_po_encoding($po_files_by_lang{$lang})); } my $source; $Text::Wrap::huge = 'overflow'; $Text::Wrap::break = qr/\n|\s(?=\S)/; { local $/; # slurp mode open INPUT, "<$FILE" or die "can't open $FILE: $!"; $source = ; close INPUT; } open OUTPUT, ">${OUTFILE}" or die; binmode (OUTPUT) if $^O eq 'MSWin32'; while ($source =~ /(^|\n+)(_*)([^:\s]+)(:[ \t]*)(.*?)(?=\n[\S\n]|$)/sg) { my $sep = $1; my $non_translated_line = $3.$4; my $string = $5; my $underscore = length($2); next if $underscore eq 0 && $non_translated_line =~ /^#/; # Remove [] dummy strings my $stripped = $string; $stripped =~ s/\[\s[^\[\]]*\],/,/g if $underscore eq 2; $stripped =~ s/\[\s[^\[\]]*\]$//; $non_translated_line .= $stripped; print OUTPUT $sep.$non_translated_line; if ($underscore) { my @str_list = rfc822deb_split($underscore, $string); for my $lang (sort keys %po_files_by_lang) { my $is_translated = 1; my $str_translated = ''; my $first = 1; for my $str (@str_list) { my $translation = $translations{$lang, $str}; if (!$translation) { $is_translated = 0; last; } # $translation may also contain [] dummy # strings, mostly to indicate an empty string $translation =~ s/\[\s[^\[\]]*\]$//; if ($first) { if ($underscore eq 2) { $str_translated .= $translation; } else { $str_translated .= Text::Tabs::expand($translation) . "\n"; } } else { if ($underscore eq 2) { $str_translated .= ', ' . $translation; } else { $str_translated .= Text::Tabs::expand( Text::Wrap::wrap(' ', ' ', $translation)) . "\n .\n"; } } $first = 0; # To fix some problems with Text::Wrap::wrap $str_translated =~ s/(\n )+\n/\n .\n/g; } next unless $is_translated; $str_translated =~ s/\n \.\n$//; $str_translated =~ s/\s+$//; $_ = $non_translated_line; s/^(\w+):\s*.*/$sep${1}-$lang.$encodings{$lang}: $str_translated/s; print OUTPUT; } } } print OUTPUT "\n"; close OUTPUT; close INPUT; } sub rfc822deb_split { # Debian defines a special way to deal with rfc822-style files: # when a value contain newlines, it consists of # 1. a short form (first line) # 2. a long description, all lines begin with a space, # and paragraphs are separated by a single dot on a line # This routine returns an array of all paragraphs, and reformat # them. # When first argument is 2, the string is a comma separated list of # values. my $type = shift; my $text = shift; $text =~ s/^[ \t]//mg; return (split(/, */, $text, 0)) if $type ne 1; return ($text) if $text !~ /\n/; $text =~ s/([^\n]*)\n//; my @list = ($1); my $str = ''; for my $line (split (/\n/, $text)) { chomp $line; if ($line =~ /^\.\s*$/) { # New paragraph $str =~ s/\s*$//; push(@list, $str); $str = ''; } elsif ($line =~ /^\s/) { # Line which must not be reformatted $str .= "\n" if length ($str) && $str !~ /\n$/; $line =~ s/\s+$//; $str .= $line."\n"; } else { # Continuation line, remove newline $str .= " " if length ($str) && $str !~ /\n$/; $str .= $line; } } $str =~ s/\s*$//; push(@list, $str) if length ($str); return @list; } sub quoted_translation { my ($xml_mode, $lang, $string) = @_; $string = entity_decode($string) if $xml_mode; $string =~ s/\\\"/\"/g; my $translation = $translations{$lang, $string}; $translation = $string if !$translation; $translation = entity_encode($translation) if $xml_mode; $translation =~ s/\"/\\\"/g; return $translation } sub quoted_merge_translations { my ($xml_mode) = @_; if (!$MULTIPLE_OUTPUT) { print "Quoted only supports Multiple Output.\n"; exit(1); } for my $lang (sort keys %po_files_by_lang) { if ( ! -d $lang ) { mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; } open INPUT, "<${FILE}" or die; open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; binmode (OUTPUT) if $^O eq 'MSWin32'; while () { s/\"(([^\"]|\\\")*[^\\\"])\"/"\"" . "ed_translation($xml_mode, $lang, $1) . "\""/ge; print OUTPUT; } close OUTPUT; close INPUT; } } 07070100038c7d000081ed0000000000000000000000014c8079160000219a0000010000010036ffffffffffffffff0000002400000000root/usr/local/bin/intltool-prepare#!//bin/perl -w # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- # Intltool .desktop, .directory Prepare Tool # # Copyright (C) 2001 Free Software Foundation. # # Intltool 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. # # Intltool 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. # # Author(s): Gediminas Paulauskas # Kenneth Christiansen ## Release information my $PROGRAM = "intltool-prepare"; my $PACKAGE = "intltool"; my $VERSION = "0.41.1"; ## Loaded modules use strict; use Getopt::Long; use File::Find; ## Scalars used by the option stuff my $HELP_ARG = "0"; my $VERSION_ARG = "0"; my $VERBOSE = "0"; my @languages; my @desktop_files; my $new; my $file; my $desktop_extension = "(desktop|soundlist|keys|directory)"; my $keywords = "Name|Comment|GenericName|SwallowTitle|description"; ## Always print as the first thing $| = 1; ## Handle options GetOptions ( "help|h" => \$HELP_ARG, "version|v" => \$VERSION_ARG, "verbose|x" => \$VERBOSE ) or &invalid_option; ## Use the supplied arguments ## Check for options. ## This section will check for the different options. sub split_on_argument { if ($VERSION_ARG) { &version; } elsif ($HELP_ARG) { &help; } else { &main; } } &split_on_argument; sub main { print "Working, please wait...\n" if (! $VERBOSE); &find_desktop_files; &append_keywords; &add_to_potfiles; &perform_rescue; &add_to_cvsignore; &fix_makefiles; &generate_empty; } sub version { print <<_EOF_; ${PROGRAM} ${PACKAGE} $VERSION Written by Gediminas Paulauskas , 2000. Copyright (C) 2000 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. _EOF_ exit; } sub help { print <<_EOF_; Usage: ${PROGRAM} [OPTION] KEYWORD... Automates preparation steps before software make use of intltool. KEYWORD is a list of additional key other than "Name", "Comment" and "description". -h, --help shows this help page -v, --version shows the version -x, --verbose show lots of feedback Report bugs to http://bugs.launchpad.net/intltool _EOF_ exit; } sub invalid_option { ## Handle invalid arguments ## my $opt = $ARGV[0]; ## print "$PROGRAM: invalid option -- $opt\n"; print STDERR "Try `$PROGRAM --help' for more information.\n"; exit 1; } sub append_keywords { my $arg; foreach $arg (@ARGV) { $keywords .= "|$arg"; } } sub add_to_potfiles { open FILE, ">>po/POTFILES.in"; my $intro = 0; foreach my $desktop (@desktop_files) { next if contains("po/POTFILES.in", "$desktop.in"); # Print explanation comment only once unless ($intro) { print FILE "# files added by intltool-prepare\n"; $intro = 1; } print FILE "$desktop.in\n"; } close FILE; } sub perform_rescue { foreach $file (@desktop_files) { &rescue_file($file); } } sub rescue_file { my ($filename) = @_; my ($msgid, $line, $lang); print "Rescuing translations from $filename ...\n" if $VERBOSE; open ORIG, "<$filename"; $line = 1; ENTRY: while () { chomp; $line++; my $entry = $_; if (($entry =~ /^($keywords)=(.*)$/) || ($entry =~ /^(\s*description)=(.*)$/)) { $msgid = $2; $msgid =~ s/\\/\\\\/g; $msgid =~ s/\"/\\"/g; } elsif (($entry =~ /^($keywords)\[(.*?)\]=(.*)$/) || ($entry =~ /^(\s*\[)(.*?)\]description=(.*)$/)) { $lang = $2; my $msgstr = $3; $msgstr =~ s/\\/\\\\/g; $msgstr =~ s/"/\\"/g; $line--; if ((-s "po/$lang.po") && (contains("po/$lang.po", "msgid \"$msgid\""))) { next ENTRY; } open POFILE, ">>po/$lang.po"; print POFILE "\n#: $filename.in:$line\n"; print POFILE "msgid \"$msgid\"\n"; print POFILE "msgstr \"$msgstr\"\n"; close POFILE; } } } sub generate_empty { my $all = ' '; foreach my $full (@desktop_files) { $new = "$full.in"; $all .= "$new "; print "Generating empty $new ...\n" if $VERBOSE; open FULL, "<$full"; open NEW, ">$new"; while () { unless ( (/^($keywords)\[.*?\]=.*$/) || (/^\s*\[(.*?)\]description=.*$/) ) { if (/^($keywords)=.*$/) { print NEW "_$_"; } elsif (/^(\s*)(description=.*)$/) { print NEW "$1_$2\n"; } else { print NEW; } } } close NEW; } unless ($all eq ' ') { print "*** Please add these files to CVS by following command: ***\n" . "cvs add$all\n"; } } sub add_to_cvsignore { my $all = ' '; my $ign; foreach $file (@desktop_files) { $file =~ /^(.*\/)?(.+?\.$desktop_extension$)$/; if ($1) { $ign = "$1.cvsignore"; } else { $ign = ".cvsignore"; } my $basename = $2; next if contains($ign, $basename); print "Appending $basename to $ign\n" if $VERBOSE; open FILE, ">>$ign"; print FILE "$basename\n"; $all .= "$file "; } close FILE; unless ($all eq ' ') { print "*** Please remove files from CVS by following command: ***\n" . "cvs remove -f$all\n"; } } sub fix_makefiles { my $file; foreach $file (@desktop_files) { my ($makefile, $line); $file =~ /^(.*\/)?(.+?\.$desktop_extension$)$/; if ($1) { $makefile = "$1Makefile.am"; } else { $makefile = "Makefile.am"; } my $basename = $2; print "Fixing $basename entry in $makefile\n" if $VERBOSE; open MAKE, $makefile; open NEWMAKE, ">$makefile.new"; my $extra = 0; while ($line = ) { $extra = 1 if $line =~ /^EXTRA_DIST/; if ($extra) { if (($line =~ /$basename/) && !($line =~ /$basename\.in/)) { $line =~ s/$basename/$basename\.in/; } $extra = 0 unless $line =~ /\\\s*$/ } else { if ($line =~ /^(\w+)_DATA\s*=\s*$basename\s*$/) { my $name = $1; $line =~ s/^$name\_DATA/$name\_in_files/; $line =~ s/$basename/$basename\.in/; $basename =~ /\.($desktop_extension)$/; my $ext = $1; $line .= "$name\_DATA = \$($name\_in_files:.$ext.in=.$ext)\n"; $ext =~ tr/a-z/A-Z/; if (!contains($makefile, "\@INTLTOOL_$ext\_RULE\@")) { $line .= "\@INTLTOOL_$ext\_RULE\@\n"; } } } print NEWMAKE $line; } close NEWMAKE; rename "$makefile.new", $makefile; } } sub contains { my ($name, $str) = @_; open CONT, "<$name"; while () { chomp; return 1 if $_ eq $str; } return 0; } sub find_desktop_files { if ($VERBOSE) { print "Found these interesting files:\n"; } else { print "Finding interesting files..."; } find (\&wanted, '.'); print "done\n" unless $VERBOSE; } sub wanted { if (/\.$desktop_extension$/) { my $file = $File::Find::name; $file =~ s/\.\///; push @desktop_files, $file; print "$file\n" if $VERBOSE; } } # vim: ts=4 sw=4 expandtab 07070100038c7e000081ed0000000000000000000000014c807916000085170000010000010036ffffffffffffffff0000002300000000root/usr/local/bin/intltool-update#!//bin/perl -w # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- # # The Intltool Message Updater # # Copyright (C) 2000-2003 Free Software Foundation. # # Intltool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # version 2 published by the Free Software Foundation. # # Intltool 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # # Authors: Kenneth Christiansen # Maciej Stachowiak # Darin Adler ## Release information my $PROGRAM = "intltool-update"; my $VERSION = "0.41.1"; my $PACKAGE = "intltool"; ## Loaded modules use strict; use Getopt::Long; use Cwd; use File::Copy; use File::Find; ## Scalars used by the option stuff my $HELP_ARG = 0; my $VERSION_ARG = 0; my $DIST_ARG = 0; my $POT_ARG = 0; my $HEADERS_ARG = 0; my $MAINTAIN_ARG = 0; my $REPORT_ARG = 0; my $VERBOSE = 0; my $GETTEXT_PACKAGE = ""; my $OUTPUT_FILE = ""; my @languages; my %varhash = (); my %po_files_by_lang = (); # Regular expressions to categorize file types. # FIXME: Please check if the following is correct my $xml_support = "xml(?:\\.in)*|". # http://www.w3.org/XML/ (Note: .in is not required) "ui|". # Bonobo specific - User Interface desc. files "lang|". # ? "glade2?(?:\\.in)*|". # Glade specific - User Interface desc. files (Note: .in is not required) "scm(?:\\.in)*|". # ? (Note: .in is not required) "oaf(?:\\.in)+|". # DEPRECATED: Replaces by Bonobo .server files "etspec|". # ? "server(?:\\.in)+|". # Bonobo specific "sheet(?:\\.in)+|". # ? "schemas(?:\\.in)+|". # GConf specific "pong(?:\\.in)+|". # DEPRECATED: PONG is not used [by GNOME] any longer. "kbd(?:\\.in)+|". # GOK specific. "policy(?:\\.in)+"; # PolicyKit files my $ini_support = "icon(?:\\.in)+|". # http://www.freedesktop.org/Standards/icon-theme-spec "desktop(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec "caves(?:\\.in)+|". # GNOME Games specific "directory(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec "soundlist(?:\\.in)+|". # GNOME specific "keys(?:\\.in)+|". # GNOME Mime database specific "theme(?:\\.in)+|". # http://www.freedesktop.org/Standards/icon-theme-spec "service(?:\\.in)+"; # DBus specific my $tlk_support = "tlk(?:\\.in)+"; # Bioware Aurora Talk Table Format my $buildin_gettext_support = "c|y|cs|cc|cpp|c\\+\\+|h|hh|gob|py(?:\\.in)*"; ## Always flush buffer when printing $| = 1; ## Sometimes the source tree will be rooted somewhere else. my $SRCDIR = $ENV{"srcdir"} || "."; my $POTFILES_in; $POTFILES_in = "<$SRCDIR/POTFILES.in"; my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null'); ## Handle options GetOptions ( "help" => \$HELP_ARG, "version" => \$VERSION_ARG, "dist|d" => \$DIST_ARG, "pot|p" => \$POT_ARG, "headers|s" => \$HEADERS_ARG, "maintain|m" => \$MAINTAIN_ARG, "report|r" => \$REPORT_ARG, "verbose|x" => \$VERBOSE, "gettext-package|g=s" => \$GETTEXT_PACKAGE, "output-file|o=s" => \$OUTPUT_FILE, ) or &Console_WriteError_InvalidOption; &Console_Write_IntltoolHelp if $HELP_ARG; &Console_Write_IntltoolVersion if $VERSION_ARG; my $arg_count = ($DIST_ARG > 0) + ($POT_ARG > 0) + ($HEADERS_ARG > 0) + ($MAINTAIN_ARG > 0) + ($REPORT_ARG > 0); &Console_Write_IntltoolHelp if $arg_count > 1; my $MODULE = $GETTEXT_PACKAGE || FindPackageName() || "unknown"; if ($POT_ARG) { &GenerateHeaders; &GeneratePOTemplate; } elsif ($HEADERS_ARG) { &GenerateHeaders; } elsif ($MAINTAIN_ARG) { &FindLeftoutFiles; } elsif ($REPORT_ARG) { &GenerateHeaders; &GeneratePOTemplate; &Console_Write_CoverageReport; } elsif ((defined $ARGV[0]) && $ARGV[0] =~ /^[a-z]/) { my $lang = $ARGV[0]; ## Report error if the language file supplied ## to the command line is non-existent &Console_WriteError_NotExisting("$SRCDIR/$lang.po") if ! -s "$SRCDIR/$lang.po"; if (!$DIST_ARG) { print "Working, please wait..." if $VERBOSE; &GenerateHeaders; &GeneratePOTemplate; } &POFile_Update ($lang, $OUTPUT_FILE); &Console_Write_TranslationStatus ($lang, $OUTPUT_FILE); } else { &Console_Write_IntltoolHelp; } exit; ######### sub Console_Write_IntltoolVersion { print <<_EOF_; ${PROGRAM} (${PACKAGE}) $VERSION Written by Kenneth Christiansen, Maciej Stachowiak, and Darin Adler. Copyright (C) 2000-2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. _EOF_ exit; } sub Console_Write_IntltoolHelp { print <<_EOF_; Usage: ${PROGRAM} [OPTION]... LANGCODE Updates PO template files and merge them with the translations. Mode of operation (only one is allowed): -p, --pot generate the PO template only -s, --headers generate the header files in POTFILES.in -m, --maintain search for left out files from POTFILES.in -r, --report display a status report for the module -d, --dist merge LANGCODE.po with existing PO template Extra options: -g, --gettext-package=NAME override PO template name, useful with --pot -o, --output-file=FILE write merged translation to FILE -x, --verbose display lots of feedback --help display this help and exit --version output version information and exit Examples of use: ${PROGRAM} --pot just create a new PO template ${PROGRAM} xy create new PO template and merge xy.po with it Report bugs to http://bugs.launchpad.net/intltool _EOF_ exit; } sub echo_n { my $str = shift; my $ret = `echo "$str"`; $ret =~ s/\n$//; # do we need the "s" flag? return $ret; } sub POFile_DetermineType ($) { my $type = $_; my $gettext_type; my $xml_regex = "(?:" . $xml_support . ")"; my $ini_regex = "(?:" . $ini_support . ")"; my $tlk_regex = "(?:" . $tlk_support . ")"; my $buildin_regex = "(?:" . $buildin_gettext_support . ")"; if ($type =~ /\[type: gettext\/([^\]].*)]/) { $gettext_type=$1; } elsif ($type =~ /schemas(\.in)+$/) { $gettext_type="schemas"; } elsif ($type =~ /glade2?(\.in)*$/) { $gettext_type="glade"; } elsif ($type =~ /scm(\.in)*$/) { $gettext_type="scheme"; } elsif ($type =~ /keys(\.in)+$/) { $gettext_type="keys"; } # bucket types elsif ($type =~ /$xml_regex$/) { $gettext_type="xml"; } elsif ($type =~ /$ini_regex$/) { $gettext_type="ini"; } elsif ($type =~ /$tlk_regex$/) { $gettext_type="tlk"; } elsif ($type =~ /$buildin_regex$/) { $gettext_type="buildin"; } else { $gettext_type="unknown"; } return "gettext\/$gettext_type"; } sub TextFile_DetermineEncoding ($) { my $gettext_code="UTF-8"; # All files are UTF-8 by default my $filetype=`file $_ | cut -d ' ' -f 2`; if ($? eq "0") { if ($filetype =~ /^(ISO|UTF)/) { chomp ($gettext_code = $filetype); } elsif ($filetype =~ /^XML/) { $gettext_code="UTF-8"; # We asume that .glade and other .xml files are UTF-8 } } return $gettext_code; } sub isNotValidMissing { my ($file) = @_; return if $file =~ /^\{arch\}\/.*$/; return if $file =~ /^$varhash{"PACKAGE"}-$varhash{"VERSION"}\/.*$/; } sub removeFromArray { my ($file, @array) = @_; my $i = 0; foreach my $potfile (@array) { delete $array[$i] if $potfile =~ m/$file/; $i++; } } sub AddFileToListIfMissing { my ($file, $list) = @_; my $name_pattern; if ($file =~ /^\.\.\//) { $name_pattern = "x3 A*"; } else { $name_pattern = "A*"; } my $file_name = unpack($name_pattern, $file); if (defined isNotValidMissing ($file_name)) { ## Remove the first 3 chars if needed and add newline push @$list, $file_name . "\n"; } } sub FindLeftoutFiles { my (@buf_i18n_plain, @buf_i18n_xml, @buf_i18n_xml_unmarked, @buf_i18n_ini, @buf_potfiles, @buf_potfiles_ignore, @buf_allfiles, @buf_allfiles_sorted, @buf_potfiles_sorted, @buf_potfiles_ignore_sorted ); ## Search and find all translatable files find sub { push @buf_i18n_plain, "$File::Find::name" if /\.($buildin_gettext_support)$/; push @buf_i18n_xml, "$File::Find::name" if /\.($xml_support)$/; push @buf_i18n_ini, "$File::Find::name" if /\.($ini_support)$/; push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/; }, ".."; find sub { push @buf_i18n_plain, "$File::Find::name" if /\.($buildin_gettext_support)$/; push @buf_i18n_xml, "$File::Find::name" if /\.($xml_support)$/; push @buf_i18n_ini, "$File::Find::name" if /\.($ini_support)$/; push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/; }, "$SRCDIR/.." if "$SRCDIR" ne "."; open POTFILES, $POTFILES_in or die "$PROGRAM: there's no POTFILES.in!\n"; @buf_potfiles = grep !/^(#|\s*$)/, ; close POTFILES; foreach (@buf_potfiles) { s/^\[.*]\s*//; } print "Searching for missing translatable files...\n" if $VERBOSE; ## Check if we should ignore some found files, when ## comparing with POTFILES.in foreach my $ignore ("POTFILES.skip", "POTFILES.ignore") { (-s "$SRCDIR/$ignore") or next; if ("$ignore" eq "POTFILES.ignore") { print "The usage of POTFILES.ignore is deprecated. Please consider moving the\n". "content of this file to POTFILES.skip.\n"; } print "Found $ignore: Ignoring files...\n" if $VERBOSE; open FILE, "<$SRCDIR/$ignore" or die "ERROR: Failed to open $SRCDIR/$ignore!\n"; while () { next if (/^$/); next if (/^(#|\s*$)/); my $skipdir = "../$_"; $skipdir = "$SRCDIR/../$_" if "$SRCDIR" ne "."; $skipdir =~ s/\n//g; my @dirignored; if (-d "$skipdir") { find sub { push @dirignored, "$File::Find::name" if /\.($buildin_gettext_support)$/; push @dirignored, "$File::Find::name" if /\.($xml_support)$/; push @dirignored, "$File::Find::name" if /\.($ini_support)$/; push @dirignored, "$File::Find::name" if /\.(schemas(\.in)+)$/; }, "$skipdir"; foreach my $ignored (@dirignored) { $ignored =~ s/^$SRCDIR\///g; $ignored =~ s/^..\///g; $ignored =~ s/$/\n/g; removeFromArray ($ignored, @buf_i18n_plain); removeFromArray ($ignored, @buf_i18n_xml); removeFromArray ($ignored, @buf_i18n_ini); removeFromArray ($ignored, @buf_i18n_xml_unmarked); push @buf_potfiles_ignore, $ignored; } next; } removeFromArray ($_, @buf_i18n_plain); removeFromArray ($_, @buf_i18n_xml); removeFromArray ($_, @buf_i18n_ini); removeFromArray ($_, @buf_i18n_xml_unmarked); push @buf_potfiles_ignore, $_; } close FILE; @buf_potfiles_ignore_sorted = sort (@buf_potfiles_ignore); } foreach my $file (@buf_i18n_plain) { my $in_comment = 0; my $in_macro = 0; my $in_string = 0; open FILE, "<$file"; while () { # Handle continued multi-line comment. if ($in_comment) { next unless s-.*\*/--; $in_comment = 0; } # Handle continued multi-line string. if ($in_string) { next unless /(\'\'\'|\"\"\")/; $in_string = 0; } # Handle continued macro. if ($in_macro) { $in_macro = 0 unless /\\$/; next; } # Handle start of macro (or any preprocessor directive). if (/^\s*\#/) { $in_macro = 1 if /^([^\\]|\\.)*\\$/; next; } # Handle comments and quoted text. while (m-(/\*|//|\'\'\'|\"\"\"|\'|\")-) # \' and \" keep emacs perl mode happy { my $match = $1; if ($match eq "/*") { if (!s-/\*.*?\*/--) { s-/\*.*--; $in_comment = 1; } } elsif ($match eq "//") { s-//.*--; } elsif ($match eq "\"\"\"" or $match eq "\'\'\'") { if (!s-$match.*?$match--) { s-$match.*--; $in_string = 1; } } else # ' or " { if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-) { warn "mismatched quotes at line $. in $file\n"; s-$match.*--; } } } if (/\w\.GetString *\(QUOTEDTEXT/) { AddFileToListIfMissing($file, \@buf_allfiles); last; } ## C_ N_ NC_ Q_ and _ are the macros defined in gi8n.h if (/(NC_|[NCQ]_|[^_]_|(^|$)[_]) *\(QUOTEDTEXT/m) { AddFileToListIfMissing($file, \@buf_allfiles); last; } # Check for direct calls to the glib gettext wrappers if (/g_d[np]?gettext[2]? *\(QUOTEDTEXT/) { AddFileToListIfMissing($file, \@buf_allfiles); last; } } close FILE; } foreach my $file (@buf_i18n_xml) { open FILE, "<$file"; while () { # FIXME: share the pattern matching code with intltool-extract if (/\s_[-A-Za-z0-9._:]+\s*=\s*\"([^"]+)\"/ || /<_[^>]+>/ || /translatable=\"yes\"/) { AddFileToListIfMissing($file, \@buf_allfiles); last; } } close FILE; } foreach my $file (@buf_i18n_ini) { open FILE, "<$file"; while () { if (/_(.*)=/) { AddFileToListIfMissing($file, \@buf_allfiles); last; } } close FILE; } foreach my $file (@buf_i18n_xml_unmarked) { AddFileToListIfMissing($file, \@buf_allfiles); } @buf_allfiles_sorted = sort (@buf_allfiles); @buf_potfiles_sorted = sort (@buf_potfiles); my %in2; foreach (@buf_potfiles_sorted) { s#^$SRCDIR/../##; s#^$SRCDIR/##; $in2{$_} = 1; } foreach (@buf_potfiles_ignore_sorted) { s#^$SRCDIR/../##; s#^$SRCDIR/##; $in2{$_} = 1; } my @result; foreach (@buf_allfiles_sorted) { my $dummy = $_; my $srcdir = $SRCDIR; $srcdir =~ s#^../##; $dummy =~ s#^$srcdir/../##; $dummy =~ s#^$srcdir/##; $dummy =~ s#_build/##; if (!exists($in2{$dummy})) { push @result, $dummy } } my @buf_potfiles_notexist; foreach (@buf_potfiles_sorted) { chomp (my $dummy = $_); if ("$dummy" ne "" and !(-f "$SRCDIR/../$dummy" or -f "../$dummy")) { push @buf_potfiles_notexist, $_; } } ## Save file with information about the files missing ## if any, and give information about this procedure. if (@result + @buf_potfiles_notexist > 0) { if (@result) { print "\n" if $VERBOSE; unlink "missing"; open OUT, ">missing"; print OUT @result; close OUT; warn "\e[1mThe following files contain translations and are currently not in use. Please\e[0m\n". "\e[1mconsider adding these to the POTFILES.in file, located in the po/ directory.\e[0m\n\n"; print STDERR @result, "\n"; warn "If some of these files are left out on purpose then please add them to\n". "POTFILES.skip instead of POTFILES.in. A file \e[1m'missing'\e[0m containing this list\n". "of left out files has been written in the current directory.\n"; warn "Please report to ". $varhash{"PACKAGE_BUGREPORT"} ."\n" if (defined $varhash{"PACKAGE_BUGREPORT"}); } if (@buf_potfiles_notexist) { unlink "notexist"; open OUT, ">notexist"; print OUT @buf_potfiles_notexist; close OUT; warn "\n" if ($VERBOSE or @result); warn "\e[1mThe following files do not exist anymore:\e[0m\n\n"; warn @buf_potfiles_notexist, "\n"; warn "Please remove them from POTFILES.in. A file \e[1m'notexist'\e[0m\n". "containing this list of absent files has been written in the current directory.\n"; warn "Please report to ". $varhash{"PACKAGE_BUGREPORT"} ."\n" if (defined $varhash{"PACKAGE_BUGREPORT"}); } } ## If there is nothing to complain about, notify the user else { print "\nAll files containing translations are present in POTFILES.in.\n" if $VERBOSE; } } sub Console_WriteError_InvalidOption { ## Handle invalid arguments print STDERR "Try `${PROGRAM} --help' for more information.\n"; exit 1; } sub isProgramInPath { my ($file) = @_; # If a file is executable (or exists on Windows), # or when it returns 0 exit status. return 1 if ( ((-x $file) or ($^O eq 'MSWin32' and (-e $file))) or (system("$file --version >$devnull") == 0)); return 0; } sub isGNUGettextTool { my ($file) = @_; # Check that we are using GNU gettext tools if (isProgramInPath ($file)) { my $version = `$file --version`; return 1 if ($version =~ m/.*\(GNU .*\).*/); } return 0; } sub GenerateHeaders { my $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} || "intltool-extract"; ## Generate the .h header files, so we can allow glade and ## xml translation support if (! isProgramInPath ("$EXTRACT")) { print STDERR "\n *** The intltool-extract script wasn't found!" ."\n *** Without it, intltool-update can not generate files.\n"; exit; } else { open (FILE, $POTFILES_in) or die "$PROGRAM: POTFILES.in not found.\n"; while () { chomp; next if /^\[\s*encoding/; ## Find xml files in POTFILES.in and generate the ## files with help from the extract script my $gettext_type= &POFile_DetermineType ($1); if (/\.($xml_support|$ini_support|$tlk_support)$/ || /^\[/) { s/^\[[^\[].*]\s*//; my @cmd = ($EXTRACT, "--update", "--type=$gettext_type", "--srcdir=$SRCDIR"); unshift (@cmd, $^X) if ($^O eq 'MSWin32' && !($EXTRACT =~ /perl/)); push (@cmd, "--quiet") if (! $VERBOSE); push (@cmd, "../$_"); system (@cmd); } } close FILE; } } # # Generate .pot file from POTFILES.in # sub GeneratePOTemplate { my $XGETTEXT = $ENV{"XGETTEXT"} || "xgettext"; my $XGETTEXT_ARGS = $ENV{"XGETTEXT_ARGS"} || ''; chomp $XGETTEXT; if (! isGNUGettextTool ("$XGETTEXT")) { print STDERR " *** GNU xgettext is not found on this system!\n". " *** Without it, intltool-update can not extract strings.\n"; exit; } print "Building $MODULE.pot...\n" if $VERBOSE; open INFILE, $POTFILES_in; unlink "POTFILES.in.temp"; open OUTFILE, ">POTFILES.in.temp" or die("Cannot open POTFILES.in.temp for writing"); my $gettext_support_nonascii = 0; # checks for GNU gettext >= 0.12 my $dummy = `$XGETTEXT --version --from-code=UTF-8 >$devnull 2>$devnull`; if ($? == 0) { $gettext_support_nonascii = 1; } else { # require gnu gettext >= 0.12 die "$PROGRAM: GNU gettext >= 0.12 is required for intltool\n"; } my $encoding = "UTF-8"; my $forced_gettext_code; my @temp_headers; my $encoding_problem_is_reported = 0; while () { next if (/^#/ or /^\s*$/); chomp; my $gettext_code; if (/^\[\s*encoding:\s*(.*)\s*\]/) { $forced_gettext_code=$1; } elsif (/\.($xml_support|$ini_support|$tlk_support)$/ || /^\[/) { s/^\[.*]\s*//; print OUTFILE "../$_.h\n"; push @temp_headers, "../$_.h"; $gettext_code = &TextFile_DetermineEncoding ("../$_.h") if ($gettext_support_nonascii and not defined $forced_gettext_code); } else { print OUTFILE "$SRCDIR/../$_\n"; $gettext_code = &TextFile_DetermineEncoding ("$SRCDIR/../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code); } next if (! $gettext_support_nonascii); if (defined $forced_gettext_code) { $encoding=$forced_gettext_code; } elsif (defined $gettext_code and "$encoding" ne "$gettext_code") { if ($encoding eq "ASCII") { $encoding=$gettext_code; } elsif ($gettext_code ne "ASCII") { # Only report once because the message is quite long if (! $encoding_problem_is_reported) { print STDERR "WARNING: You should use the same file encoding for all your project files,\n". " but $PROGRAM thinks that most of the source files are in\n". " $encoding encoding, while \"$_\" is (likely) in\n". " $gettext_code encoding. If you are sure that all translatable strings\n". " are in same encoding (say UTF-8), please \e[1m*prepend*\e[0m the following\n". " line to POTFILES.in:\n\n". " [encoding: UTF-8]\n\n". " and make sure that configure.in/ac checks for $PACKAGE >= 0.27 .\n". "(such warning message will only be reported once.)\n"; $encoding_problem_is_reported = 1; } } } } close OUTFILE; close INFILE; unlink "$MODULE.pot"; my @xgettext_argument=("$XGETTEXT", "--add-comments", "--directory\=.", "--default-domain\=$MODULE", "--flag\=g_strdup_printf:1:c-format", "--flag\=g_string_printf:2:c-format", "--flag\=g_string_append_printf:2:c-format", "--flag\=g_error_new:3:c-format", "--flag\=g_set_error:4:c-format", "--flag\=g_markup_printf_escaped:1:c-format", "--flag\=g_log:3:c-format", "--flag\=g_print:1:c-format", "--flag\=g_printerr:1:c-format", "--flag\=g_printf:1:c-format", "--flag\=g_fprintf:2:c-format", "--flag\=g_sprintf:2:c-format", "--flag\=g_snprintf:3:c-format", "--flag\=g_scanner_error:2:c-format", "--flag\=g_scanner_warn:2:c-format", "--output\=$MODULE\.pot", "--files-from\=\.\/POTFILES\.in\.temp"); my $XGETTEXT_KEYWORDS = &FindPOTKeywords; push @xgettext_argument, $XGETTEXT_KEYWORDS; my $MSGID_BUGS_ADDRESS = &FindMakevarsBugAddress; push @xgettext_argument, "--msgid-bugs-address\=\"$MSGID_BUGS_ADDRESS\"" if $MSGID_BUGS_ADDRESS; push @xgettext_argument, "--from-code\=$encoding" if ($gettext_support_nonascii); push @xgettext_argument, $XGETTEXT_ARGS if $XGETTEXT_ARGS; my $xgettext_command = join ' ', @xgettext_argument; # intercept xgettext error message print "Running $xgettext_command\n" if $VERBOSE; my $xgettext_error_msg = `$xgettext_command 2>\&1`; my $command_failed = $?; unlink "POTFILES.in.temp"; print "Removing generated header (.h) files..." if $VERBOSE; unlink foreach (@temp_headers); print "done.\n" if $VERBOSE; if (! $command_failed) { if (! -e "$MODULE.pot") { print "None of the files in POTFILES.in contain strings marked for translation.\n" if $VERBOSE; } else { print "Wrote $MODULE.pot\n" if $VERBOSE; } } else { if ($xgettext_error_msg =~ /--from-code/) { my $errlocation = "unknown"; if ($xgettext_error_msg =~ /Non-ASCII string at (.*)\..*/) { $errlocation = $1; } print STDERR "ERROR: xgettext failed to generate PO tempalte file because the following \n". " file contains strings marked for translation, not encoded in UTF-8. \n". " Please ensure all strings marked for translation are UTF-8 encoded. \n\n". " $errlocation\n\n"; } else { print STDERR "$xgettext_error_msg"; if (-e "$MODULE.pot") { # is this possible? print STDERR "ERROR: xgettext failed but still managed to generate PO template file.\n". " Please consult error message above if there is any.\n"; } else { print STDERR "ERROR: xgettext failed to generate PO template file. Please consult\n". " error message above if there is any.\n"; } } exit (1); } } sub POFile_Update { -f "$MODULE.pot" or die "$PROGRAM: $MODULE.pot does not exist.\n"; my $MSGMERGE = $ENV{"MSGMERGE"} || "msgmerge"; my ($lang, $outfile) = @_; if (! isGNUGettextTool ("$MSGMERGE")) { print STDERR " *** GNU msgmerge is not found on this system!\n". " *** Without it, intltool-update can not extract strings.\n"; exit; } print "Merging $SRCDIR/$lang.po with $MODULE.pot..." if $VERBOSE; my $infile = "$SRCDIR/$lang.po"; $outfile = "$SRCDIR/$lang.po" if ($outfile eq ""); # I think msgmerge won't overwrite old file if merge is not successful system ("$MSGMERGE", "-o", $outfile, $infile, "$MODULE.pot"); } sub Console_WriteError_NotExisting { my ($file) = @_; ## Report error if supplied language file is non-existing print STDERR "$PROGRAM: $file does not exist!\n"; print STDERR "Try '$PROGRAM --help' for more information.\n"; exit; } sub GatherPOFiles { my @po_files = glob ("./*.po"); @languages = map (&POFile_GetLanguage, @po_files); foreach my $lang (@languages) { $po_files_by_lang{$lang} = shift (@po_files); } } sub POFile_GetLanguage ($) { s/^(.*\/)?(.+)\.po$/$2/; return $_; } sub Console_Write_TranslationStatus { my ($lang, $output_file) = @_; my $MSGFMT = $ENV{"MSGFMT"} || "msgfmt"; if (! isGNUGettextTool ("$MSGFMT")) { print STDERR " *** GNU msgfmt is not found on this system!\n". " *** Without it, intltool-update can not extract strings.\n"; exit; } $output_file = "$SRCDIR/$lang.po" if ($output_file eq ""); system ("$MSGFMT", "-o", "$devnull", "--verbose", $output_file); } sub Console_Write_CoverageReport { my $MSGFMT = $ENV{"MSGFMT"} || "msgfmt"; if (! isGNUGettextTool ("$MSGFMT")) { print STDERR " *** GNU msgfmt is not found on this system!\n". " *** Without it, intltool-update can not extract strings.\n"; exit; } &GatherPOFiles; foreach my $lang (@languages) { print STDERR "$lang: "; &POFile_Update ($lang, ""); } print STDERR "\n\n * Current translation support in $MODULE \n\n"; foreach my $lang (@languages) { print STDERR "$lang: "; system ("$MSGFMT", "-o", "$devnull", "--verbose", "$SRCDIR/$lang.po"); } } sub SubstituteVariable { my ($str) = @_; # always need to rewind file whenever it has been accessed seek (CONF, 0, 0); # cache each variable. varhash is global to we can add # variables elsewhere. while () { if (/^(\w+)=(.*)$/) { ($varhash{$1} = $2) =~ s/^["'](.*)["']$/$1/; } } if ($str =~ /^(.*)\${?([A-Z_]+)}?(.*)$/) { my $rest = $3; my $untouched = $1; my $sub = ""; # Ignore recursive definitions of variables $sub = $varhash{$2} if defined $varhash{$2} and $varhash{$2} !~ /\${?$2}?/; return SubstituteVariable ("$untouched$sub$rest"); } # We're using Perl backticks ` and "echo -n" here in order to # expand any shell escapes (such as backticks themselves) in every variable return echo_n ($str); } sub CONF_Handle_Open { my $base_dirname = getcwd(); $base_dirname =~ s@.*/@@; my ($conf_in, $src_dir); if ($base_dirname =~ /^po(-.+)?$/) { if (-f "Makevars") { my $makefile_source; local (*IN); open (IN, ") { if (/^top_builddir[ \t]*=/) { $src_dir = $_; $src_dir =~ s/^top_builddir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; chomp $src_dir; if (-f "$src_dir" . "/configure.ac") { $conf_in = "$src_dir" . "/configure.ac" . "\n"; } else { $conf_in = "$src_dir" . "/configure.in" . "\n"; } last; } } close IN; $conf_in || die "Cannot find top_builddir in Makevars."; } elsif (-f "$SRCDIR/../configure.ac") { $conf_in = "$SRCDIR/../configure.ac"; } elsif (-f "$SRCDIR/../configure.in") { $conf_in = "$SRCDIR/../configure.in"; } else { my $makefile_source; local (*IN); open (IN, ") { if (/^top_srcdir[ \t]*=/) { $src_dir = $_; $src_dir =~ s/^top_srcdir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; chomp $src_dir; $conf_in = "$src_dir" . "/configure.in" . "\n"; last; } } close IN; $conf_in || die "Cannot find top_srcdir in Makefile."; } open (CONF, "<$conf_in"); } else { print STDERR "$PROGRAM: Unable to proceed.\n" . "Make sure to run this script inside the po directory.\n"; exit; } } sub FindPackageName { my $version; my $domain = &FindMakevarsDomain; my $name = $domain || "untitled"; my $bugurl; &CONF_Handle_Open; my $conf_source; { local (*IN); open (IN, "<&CONF") || return $name; seek (IN, 0, 0); local $/; # slurp mode $conf_source = ; close IN; } # priority for getting package name: # 1. GETTEXT_PACKAGE # 2. first argument of AC_INIT (with >= 2 arguments) # 3. first argument of AM_INIT_AUTOMAKE (with >= 2 argument) # /^AM_INIT_AUTOMAKE\([\s\[]*([^,\)\s\]]+)/m # the \s makes this not work, why? if ($conf_source =~ /^AM_INIT_AUTOMAKE\(([^,\)]+),([^,\)]+)/m) { ($name, $version) = ($1, $2); $name =~ s/[\[\]\s]//g; $version =~ s/[\[\]\s]//g; $name =~ s/\(+$//g; $version =~ s/\(+$//g; $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/); $varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/); $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/); $varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/); } if ($conf_source =~ /^AC_INIT\(([^,\)]+),([^,\)]+)[,]?([^,\)]+)?/m) { ($name, $version) = ($1, $2); $bugurl = $3 if (defined $3); # Handle m4_esyscmd # FIXME: We should do this in a more generic way that works for all vars if ($version =~ /m4_esyscmd\([\[]?([^\)\]]+)/) { my $cwd = getcwd (); chdir ("$SRCDIR/.."); $version = qx($1); chdir ($cwd); } $name =~ s/[\[\]\s]//g; $version =~ s/[\[\]\s]//g; $bugurl =~ s/[\[\]\s]//g if (defined $bugurl); $name =~ s/\(+$//g; $version =~ s/\(+$//g; $bugurl =~ s/\(+$//g if (defined $bugurl); $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/); $varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/); $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/); $varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/); $varhash{"PACKAGE_BUGREPORT"} = $bugurl if (defined $bugurl and not $bugurl =~ /\${?\w+}?/); } # \s makes this not work, why? $name = $1 if $conf_source =~ /^GETTEXT_PACKAGE=\[?([^\n\]]+)/m; # m4 macros AC_PACKAGE_NAME, AC_PACKAGE_VERSION etc. have same value # as corresponding $PACKAGE_NAME, $PACKAGE_VERSION etc. shell variables. $name =~ s/\bAC_PACKAGE_/\$PACKAGE_/g; $name = $domain if $domain; $name = SubstituteVariable ($name); $name =~ s/^["'](.*)["']$/$1/; return $name if $name; } sub FindPOTKeywords { my $keywords = "--keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=Q_ --keyword=g_dgettext:2 --keyword=g_dngettext:2,3 --keyword=g_dpgettext:2 --keyword=g_dpgettext2=2c,3"; my $varname = "XGETTEXT_OPTIONS"; my $make_source; { local (*IN); open (IN, "; close IN; } # unwrap lines split with a trailing \ $make_source =~ s/\\ $ \n/ /mxg; $keywords = $1 if $make_source =~ /^$varname[ ]*=\[?([^\n\]]+)/m; return $keywords; } sub FindMakevarsDomain { my $domain = ""; my $makevars_source; { local (*IN); open (IN, "; close IN; } $domain = $1 if $makevars_source =~ /^DOMAIN[ ]*=\[?([^\n\]\$]+)/m; $domain =~ s/^\s+//; $domain =~ s/\s+$//; return $domain; } sub FindMakevarsBugAddress { my $address = ""; my $makevars_source; { local (*IN); open (IN, "; close IN; } $address = $1 if $makevars_source =~ /^MSGID_BUGS_ADDRESS[ ]*=\[?([^\n\]\$]+)/m; $address =~ s/^\s+//; $address =~ s/\s+$//; return $address; } 07070100038c7b000081ed0000000000000000000000014c80791600006df90000010000010036ffffffffffffffff0000002400000000root/usr/local/bin/intltool-extract#!//bin/perl -w # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- # # The Intltool Message Extractor # # Copyright (C) 2000-2001, 2003 Free Software Foundation. # # Intltool 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. # # Intltool 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # # Authors: Kenneth Christiansen # Darin Adler # ## Release information my $PROGRAM = "intltool-extract"; my $PACKAGE = "intltool"; my $VERSION = "0.41.1"; ## Loaded modules use strict; use File::Basename; use Getopt::Long; ## Scalars used by the option stuff my $TYPE_ARG = "0"; my $LOCAL_ARG = "0"; my $HELP_ARG = "0"; my $VERSION_ARG = "0"; my $UPDATE_ARG = "0"; my $QUIET_ARG = "0"; my $SRCDIR_ARG = "."; my $NOMSGCTXT_ARG = "0"; my $FILE; my $OUTFILE; my $gettext_type = ""; my $input; my %messages = (); my %loc = (); my %count = (); my %comments = (); my $strcount = 0; my $XMLCOMMENT = ""; ## Use this instead of \w for XML files to handle more possible characters. my $w = "[-A-Za-z0-9._:]"; ## Always print first $| = 1; ## Handle options GetOptions ( "type=s" => \$TYPE_ARG, "local|l" => \$LOCAL_ARG, "help|h" => \$HELP_ARG, "version|v" => \$VERSION_ARG, "update" => \$UPDATE_ARG, "quiet|q" => \$QUIET_ARG, "srcdir=s" => \$SRCDIR_ARG, "nomsgctxt" => \$NOMSGCTXT_ARG, ) or &error; &split_on_argument; ## Check for options. ## This section will check for the different options. sub split_on_argument { if ($VERSION_ARG) { &version; } elsif ($HELP_ARG) { &help; } elsif ($LOCAL_ARG) { &place_local; &extract; } elsif ($UPDATE_ARG) { &place_normal; &extract; } elsif (@ARGV > 0) { &place_normal; &message; &extract; } else { &help; } } sub place_normal { $FILE = $ARGV[0]; $OUTFILE = "$FILE.h"; my $dirname = dirname ($OUTFILE); if (! -d "$dirname" && $dirname ne "") { system ("mkdir -p $dirname"); } } sub place_local { $FILE = $ARGV[0]; $OUTFILE = fileparse($FILE, ()); if (!-e "tmp/") { system("mkdir tmp/"); } $OUTFILE = "./tmp/$OUTFILE.h" } sub determine_type { if ($TYPE_ARG =~ /^gettext\/(.*)/) { $gettext_type=$1 } } ## Sub for printing release information sub version{ print <<_EOF_; ${PROGRAM} (${PACKAGE}) $VERSION Copyright (C) 2000, 2003 Free Software Foundation, Inc. Written by Kenneth Christiansen, 2000. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. _EOF_ exit; } ## Sub for printing usage information sub help { print <<_EOF_; Usage: ${PROGRAM} [OPTION]... [FILENAME] Generates a header file from an XML source file. It grabs all strings between <_translatable_node> and its end tag in XML files. Read manpage (man ${PROGRAM}) for more info. --type=TYPE Specify the file type of FILENAME. Currently supports: "gettext/glade", "gettext/ini", "gettext/keys" "gettext/rfc822deb", "gettext/schemas", "gettext/scheme", "gettext/xml", "gettext/quoted", "gettext/quotedxml", "gettext/tlk" -l, --local Writes output into current working directory (conflicts with --update) --update Writes output into the same directory the source file reside (conflicts with --local) --srcdir Root of the source tree -v, --version Output version information and exit -h, --help Display this help and exit -q, --quiet Quiet mode Report bugs to http://bugs.launchpad.net/intltool _EOF_ exit; } ## Sub for printing error messages sub error{ print STDERR "Try `${PROGRAM} --help' for more information.\n"; exit; } sub message { print "Generating C format header file for translation.\n" unless $QUIET_ARG; } sub extract { &determine_type; &convert; open OUT, ">$OUTFILE"; binmode (OUT) if $^O eq 'MSWin32'; &msg_write; close OUT; print "Wrote $OUTFILE\n" unless $QUIET_ARG; } sub convert { ## Reading the file { local (*IN); local $/; #slurp mode open (IN, "<$SRCDIR_ARG/$FILE") || die "can't open $SRCDIR_ARG/$FILE: $!"; binmode (IN); $input = ; close IN; } &type_ini if $gettext_type eq "ini"; &type_keys if $gettext_type eq "keys"; &type_xml if $gettext_type eq "xml"; &type_glade if $gettext_type eq "glade"; &type_scheme if $gettext_type eq "scheme"; &type_schemas if $gettext_type eq "schemas"; &type_rfc822deb if $gettext_type eq "rfc822deb"; &type_quoted if $gettext_type eq "quoted"; &type_quotedxml if $gettext_type eq "quotedxml"; &type_tlk if $gettext_type eq "tlk"; } sub entity_decode_minimal { local ($_) = @_; s/'/'/g; # ' s/"/"/g; # " s/&/&/g; return $_; } sub entity_decode { local ($_) = @_; s/'/'/g; # ' s/"/"/g; # " s/<//g; s/&/&/g; return $_; } sub escape_char { return '\"' if $_ eq '"'; return '\n' if $_ eq "\n"; return '\\\\' if $_ eq '\\'; return $_; } sub escape { my ($string) = @_; return join "", map &escape_char, split //, $string; } sub type_ini { ### For generic translatable desktop files ### while ($input =~ /^(#(.+)\n)?^_.*=(.*)$/mg) { if (defined($2)) { $comments{$3} = $2; } $messages{$3} = []; } } sub type_keys { ### For generic translatable mime/keys files ### while ($input =~ /^\s*_\w+=(.*)$/mg) { $messages{$1} = []; } } sub type_xml { ### For generic translatable XML files ### my $tree = readXml($input); parseTree(0, $tree); } sub print_var { my $var = shift; my $vartype = ref $var; if ($vartype =~ /ARRAY/) { my @arr = @{$var}; print "[ "; foreach my $el (@arr) { print_var($el); print ", "; } print "] "; } elsif ($vartype =~ /HASH/) { my %hash = %{$var}; print "{ "; foreach my $key (keys %hash) { print "$key => "; print_var($hash{$key}); print ", "; } print "} "; } else { print $var; } } # Same syntax as getAttributeString in intltool-merge.in.in, similar logic (look for ## differences comment) sub getAttributeString { my $sub = shift; my $do_translate = shift || 1; my $language = shift || ""; my $translate = shift; my $result = ""; foreach my $e (reverse(sort(keys %{ $sub }))) { my $key = $e; my $string = $sub->{$e}; my $quote = '"'; $string =~ s/^[\s]+//; $string =~ s/[\s]+$//; if ($string =~ /^'.*'$/) { $quote = "'"; } $string =~ s/^['"]//g; $string =~ s/['"]$//g; ## differences from intltool-merge.in.in if ($key =~ /^_/) { $comments{entity_decode($string)} = $XMLCOMMENT if $XMLCOMMENT; $messages{entity_decode($string)} = []; $$translate = 2; } ## differences end here from intltool-merge.in.in $result .= " $key=$quote$string$quote"; } return $result; } # Verbatim copy from intltool-merge.in.in sub getXMLstring { my $ref = shift; my $spacepreserve = shift || 0; my @list = @{ $ref }; my $result = ""; my $count = scalar(@list); my $attrs = $list[0]; my $index = 1; $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); while ($index < $count) { my $type = $list[$index]; my $content = $list[$index+1]; if (! $type ) { # We've got CDATA if ($content) { # lets strip the whitespace here, and *ONLY* here $content =~ s/\s+/ /gs if (!$spacepreserve); $result .= $content; } } elsif ( "$type" ne "1" ) { # We've got another element $result .= "<$type"; $result .= getAttributeString(@{$content}[0], 0); # no nested translatable elements if ($content) { my $subresult = getXMLstring($content, $spacepreserve); if ($subresult) { $result .= ">".$subresult . ""; } else { $result .= "/>"; } } else { $result .= "/>"; } } $index += 2; } return $result; } # Verbatim copy from intltool-merge.in.in, except for MULTIPLE_OUTPUT handling removed # Translate list of nodes if necessary sub translate_subnodes { my $fh = shift; my $content = shift; my $language = shift || ""; my $singlelang = shift || 0; my $spacepreserve = shift || 0; my @nodes = @{ $content }; my $count = scalar(@nodes); my $index = 0; while ($index < $count) { my $type = $nodes[$index]; my $rest = $nodes[$index+1]; traverse($fh, $type, $rest, $language, $spacepreserve); $index += 2; } } # Based on traverse() in intltool-merge.in.in sub traverse { my $fh = shift; # unused, to allow us to sync code between -merge and -extract my $nodename = shift; my $content = shift; my $language = shift || ""; my $spacepreserve = shift || 0; if ($nodename && "$nodename" eq "1") { $XMLCOMMENT = $content; } elsif ($nodename) { # element my @all = @{ $content }; my $attrs = shift @all; my $translate = 0; my $outattr = getAttributeString($attrs, 1, $language, \$translate); if ($nodename =~ /^_/) { $translate = 1; $nodename =~ s/^_//; } my $lookup = ''; $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); if ($translate) { $lookup = getXMLstring($content, $spacepreserve); if (!$spacepreserve) { $lookup =~ s/^\s+//s; $lookup =~ s/\s+$//s; } if (exists $attrs->{"msgctxt"}) { my $context = entity_decode ($attrs->{"msgctxt"}); $context =~ s/^["'](.*)["']/$1/; $lookup = "$context\004$lookup"; } if ($lookup && $translate != 2) { $comments{$lookup} = $XMLCOMMENT if $XMLCOMMENT; $messages{$lookup} = []; } elsif ($translate == 2) { translate_subnodes($fh, \@all, $language, 1, $spacepreserve); } } else { $XMLCOMMENT = ""; my $count = scalar(@all); if ($count > 0) { my $index = 0; while ($index < $count) { my $type = $all[$index]; my $rest = $all[$index+1]; traverse($fh, $type, $rest, $language, $spacepreserve); $index += 2; } } } $XMLCOMMENT = ""; } } # Verbatim copy from intltool-merge.in.in, $fh for compatibility sub parseTree { my $fh = shift; my $ref = shift; my $language = shift || ""; my $name = shift @{ $ref }; my $cont = shift @{ $ref }; while (!$name || "$name" eq "1") { $name = shift @{ $ref }; $cont = shift @{ $ref }; } my $spacepreserve = 0; my $attrs = @{$cont}[0]; $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); traverse($fh, $name, $cont, $language, $spacepreserve); } # Verbatim copy from intltool-merge.in.in sub intltool_tree_comment { my $expat = shift; my $data = $expat->original_string(); my $clist = $expat->{Curlist}; my $pos = $#$clist; $data =~ s/^$//s; push @$clist, 1 => $data; } # Verbatim copy from intltool-merge.in.in sub intltool_tree_cdatastart { my $expat = shift; my $clist = $expat->{Curlist}; my $pos = $#$clist; push @$clist, 0 => $expat->original_string(); } # Verbatim copy from intltool-merge.in.in sub intltool_tree_cdataend { my $expat = shift; my $clist = $expat->{Curlist}; my $pos = $#$clist; $clist->[$pos] .= $expat->original_string(); } # Verbatim copy from intltool-merge.in.in sub intltool_tree_char { my $expat = shift; my $text = shift; my $clist = $expat->{Curlist}; my $pos = $#$clist; # Use original_string so that we retain escaped entities # in CDATA sections. # if ($pos > 0 and $clist->[$pos - 1] eq '0') { $clist->[$pos] .= $expat->original_string(); } else { push @$clist, 0 => $expat->original_string(); } } # Verbatim copy from intltool-merge.in.in sub intltool_tree_start { my $expat = shift; my $tag = shift; my @origlist = (); # Use original_string so that we retain escaped entities # in attribute values. We must convert the string to an # @origlist array to conform to the structure of the Tree # Style. # my @original_array = split /\x/, $expat->original_string(); my $source = $expat->original_string(); # Remove leading tag. # $source =~ s|^\s*<\s*(\S+)||s; # Grab attribute key/value pairs and push onto @origlist array. # while ($source) { if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/) { $source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s; push @origlist, $1; push @origlist, '"' . $2 . '"'; } elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/) { $source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s; push @origlist, $1; push @origlist, "'" . $2 . "'"; } else { last; } } my $ol = [ { @origlist } ]; push @{ $expat->{Lists} }, $expat->{Curlist}; push @{ $expat->{Curlist} }, $tag => $ol; $expat->{Curlist} = $ol; } # Copied from intltool-merge.in.in and added comment handler. sub readXml { my $xmldoc = shift || return; my $ret = eval 'require XML::Parser'; if(!$ret) { die "You must have XML::Parser installed to run $0\n\n"; } my $xp = new XML::Parser(Style => 'Tree'); $xp->setHandlers(Char => \&intltool_tree_char); $xp->setHandlers(Start => \&intltool_tree_start); $xp->setHandlers(CdataStart => \&intltool_tree_cdatastart); $xp->setHandlers(CdataEnd => \&intltool_tree_cdataend); ## differences from intltool-merge.in.in $xp->setHandlers(Comment => \&intltool_tree_comment); ## differences end here from intltool-merge.in.in my $tree = $xp->parse($xmldoc); #print_var($tree); # Hello thereHowdydo # would be: # [foo, [{}, 1, "comment", head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar, # [{}, 0, "Howdy", ref, [{}]], 0, "do" ] ] return $tree; } sub type_schemas { ### For schemas XML files ### # FIXME: We should handle escaped < (less than) while ($input =~ / \s* (\s*(?:\s*)?(.*?)\s*<\/default>\s*)? (\s*(?:\s*)?(.*?)\s*<\/short>\s*)? (\s*(?:\s*)?(.*?)\s*<\/long>\s*)? <\/locale> /sgx) { my @totranslate = ($3,$6,$9); my @eachcomment = ($2,$5,$8); foreach (@totranslate) { my $currentcomment = shift @eachcomment; next if !$_; s/\s+/ /g; $messages{entity_decode_minimal($_)} = []; $comments{entity_decode_minimal($_)} = $currentcomment if (defined($currentcomment)); } } } sub type_rfc822deb { ### For rfc822-style Debian configuration files ### my $lineno = 1; my $type = ''; while ($input =~ /\G(.*?)(^|\n)(_+)([^:]+):[ \t]*(.*?)(?=\n\S|$)/sg) { my ($pre, $newline, $underscore, $tag, $text) = ($1, $2, $3, $4, $5); while ($pre =~ m/\n/g) { $lineno ++; } $lineno += length($newline); my @str_list = rfc822deb_split(length($underscore), $text); for my $str (@str_list) { $strcount++; $messages{$str} = []; $loc{$str} = $lineno; $count{$str} = $strcount; my $usercomment = ''; while($pre =~ s/(^|\n)#([^\n]*)$//s) { $usercomment = "\n" . $2 . $usercomment; } $comments{$str} = $tag . $usercomment; } $lineno += ($text =~ s/\n//g); } } sub rfc822deb_split { # Debian defines a special way to deal with rfc822-style files: # when a value contain newlines, it consists of # 1. a short form (first line) # 2. a long description, all lines begin with a space, # and paragraphs are separated by a single dot on a line # This routine returns an array of all paragraphs, and reformat # them. # When first argument is 2, the string is a comma separated list of # values. my $type = shift; my $text = shift; $text =~ s/^[ \t]//mg; return (split(/, */, $text, 0)) if $type ne 1; return ($text) if $text !~ /\n/; $text =~ s/([^\n]*)\n//; my @list = ($1); my $str = ''; for my $line (split (/\n/, $text)) { chomp $line; if ($line =~ /^\.\s*$/) { # New paragraph $str =~ s/\s*$//; push(@list, $str); $str = ''; } elsif ($line =~ /^\s/) { # Line which must not be reformatted $str .= "\n" if length ($str) && $str !~ /\n$/; $line =~ s/\s+$//; $str .= $line."\n"; } else { # Continuation line, remove newline $str .= " " if length ($str) && $str !~ /\n$/; $str .= $line; } } $str =~ s/\s*$//; push(@list, $str) if length ($str); return @list; } sub type_quoted { while ($input =~ /\"(([^\"]|\\\")*[^\\\"])\"/g) { my $message = $1; my $before = $`; $message =~ s/\\\"/\"/g; $before =~ s/[^\n]//g; $messages{$message} = []; $loc{$message} = length ($before) + 2; } } sub type_quotedxml { while ($input =~ /\"(([^\"]|\\\")*[^\\\"])\"/g) { my $message = $1; my $before = $`; $message =~ s/\\\"/\"/g; $message = entity_decode($message); $before =~ s/[^\n]//g; $messages{$message} = []; $loc{$message} = length ($before) + 2; } } sub type_glade { ### For translatable Glade XML files ### my $tags = "label|title|text|format|copyright|comments|preview_text|tooltip|message"; while ($input =~ /<($tags)>([^<]+)<\/($tags)>/sg) { # Glade sometimes uses tags that normally mark translatable things for # little bits of non-translatable content. We work around this by not # translating strings that only includes something like label4 or window1. $messages{entity_decode($2)} = [] unless $2 =~ /^(window|label|dialog)[0-9]+$/; } while ($input =~ /(..[^<]*)<\/items>/sg) { for my $item (split (/\n/, $1)) { $messages{entity_decode($item)} = []; } } ## handle new glade files while ($input =~ /<(property|atkproperty|col)\s+[^>]*translatable\s*=\s*"yes"(?:\s+[^>]*context\s*=\s*"([^"]*)")?(?:\s+[^>]*comments\s*=\s*"([^"]*)")?[^>]*>([^<]+)<\/\1>/sg) { if (!($4 =~ /^(window|label)[0-9]+$/)) { my $message = entity_decode($4); if (defined($2)) { $message = entity_decode($2) . "\004" . $message; } $messages{$message} = []; if (defined($3)) { $comments{$message} = entity_decode($3) ; } } } while ($input =~ /]*)"\s+description="([^>]+)"\/>/sg) { $messages{entity_decode_minimal($2)} = []; } } sub type_scheme { my ($line, $i, $state, $str, $trcomment, $char); for $line (split(/\n/, $input)) { $i = 0; $state = 0; # 0 - nothing, 1 - string, 2 - translatable string while ($i < length($line)) { if (substr($line,$i,1) eq "\"") { if ($state == 2) { $comments{$str} = $trcomment if ($trcomment); $messages{$str} = []; $str = ''; $state = 0; $trcomment = ""; } elsif ($state == 1) { $str = ''; $state = 0; $trcomment = ""; } else { $state = 1; $str = ''; if ($i>0 && substr($line,$i-1,1) eq '_') { $state = 2; } } } elsif (!$state) { if (substr($line,$i,1) eq ";") { $trcomment = substr($line,$i+1); $trcomment =~ s/^;*\s*//; $i = length($line); } elsif ($trcomment && substr($line,$i,1) !~ /\s|\(|\)|_/) { $trcomment = ""; } } else { if (substr($line,$i,1) eq "\\") { $char = substr($line,$i+1,1); if ($char ne "\"" && $char ne "\\") { $str = $str . "\\"; } $i++; } $str = $str . substr($line,$i,1); } $i++; } } } sub type_tlk { my ($ftype, $fvers, $langid, $strcount, $stroff); my $count = 0; my $pos = 0; my @inputa = split (//, $input, 21); my $foo; my $strdata; $ftype = substr ($input, 0, 3); $fvers = substr ($input, 4, 7); $langid = unpack ("L", $inputa[8] . $inputa[9] . $inputa[10] . $inputa[11]); $strcount = unpack ("L", $inputa[12] . $inputa[13] . $inputa[14] . $inputa[15]); $stroff = unpack ("L", $inputa[16] . $inputa[17] . $inputa[18] . $inputa[19]); use bytes; $strdata = bytes::substr ($input, $stroff); my $sinpos = 20; $foo = $inputa[$sinpos]; $sinpos = 40 * 2000; @inputa = split (//, $foo, $sinpos + 1); $pos = 0; while ($count < $strcount) { my ($flags, $soundref, $volvar, $pitch, $offset, $strsize, $sndlen) = 0; if ($count > 0 && $count % 2000 == 0) { $foo = $inputa[$sinpos]; my $numleft = ($strcount - $count); if ($numleft > 2000) { $sinpos = 40 * 2000; } else { $sinpos = 40 * $numleft; } @inputa = split (//, $foo, $sinpos + 1); my $numbytes = @inputa; $pos = 0; } $flags = unpack ("L", $inputa[$pos] . $inputa[$pos + 1] . $inputa[$pos + 2] . $inputa[$pos + 3]); $pos += 4; if ($flags & 0x0002) { $soundref = join ('', @inputa[$pos..$pos + 15]); $soundref =~ s/\0//g; } $pos += 16; # According to the Bioware Aurora Talk Table Format documentation # the VolumeVariance and PitchVariance DWORDs are not used # We increment the pos counter, but do not read the data, here # $volvar = unpack ("L", $inputa[$pos] . $inputa[$pos + 1] . # $inputa[$pos + 2] . $inputa[$pos + 3]); $pos += 4; # $pitch = unpack ("L", $inputa[$pos] . $inputa[$pos + 1] . # $inputa[$pos + 2] . $inputa[$pos + 3]); $pos += 4; $offset = unpack ("L", $inputa[$pos] . $inputa[$pos + 1] . $inputa[$pos + 2] . $inputa[$pos + 3]) if ($flags & 0x0001); $pos += 4; $strsize = unpack ("L", $inputa[$pos] . $inputa[$pos + 1] . $inputa[$pos + 2] . $inputa[$pos + 3]) if ($flags & 0x0001); $pos += 4; $sndlen = unpack ("d", $inputa[$pos] . $inputa[$pos + 1] . $inputa[$pos + 2] . $inputa[$pos + 3]) if ($flags & 0x0004); $pos += 4; if (defined $strsize && $strsize > 0) { my $message = substr ($strdata, $offset, $strsize); if (defined $message) { use Encode; Encode::from_to ($message, "iso-8859-1", "UTF-8"); $messages{$message} = []; if ($message =~ /^Bad Strref$/ ) { $comments{$message} = "DO NOT Translate this Entry."; $comments{$message} .= "\nTLK:position=$count"; } else { $comments{$message} = "TLK:position=$count"; $comments{$message} .= "; TLK:sndresref=$soundref" if (defined $soundref && $soundref ne ""); $comments{$message} .= "; TLK:sndlen=$sndlen" if (defined $sndlen && $sndlen != 0); } } else { print STDERR "Missing message? ID: $count\n"; } } $count++; } } sub msg_write { my @msgids; if (%count) { @msgids = sort { $count{$a} <=> $count{$b} } keys %count; } else { @msgids = sort keys %messages; } for my $message (@msgids) { my $offsetlines = 1; my $context = undef; $offsetlines++ if $message =~ /%/; if (defined ($comments{$message})) { while ($comments{$message} =~ m/\n/g) { $offsetlines++; } } print OUT "# ".($loc{$message} - $offsetlines). " \"$FILE\"\n" if defined $loc{$message}; print OUT "/* ".$comments{$message}." */\n" if defined $comments{$message}; print OUT "/* xgettext:no-c-format */\n" if $message =~ /%/; if ($message =~ /(.*)\004(.*)/) { $context = $1; $message = $2; } my @lines = split (/\n/, $message, -1); for (my $n = 0; $n < @lines; $n++) { if ($n == 0) { if (defined $context) { if ($NOMSGCTXT_ARG) { print OUT "char *s = N_(\"", $context, "|"; } else { print OUT "char *s = C_(\"", $context, "\", \""; } } else { print OUT "char *s = N_(\""; } } else { print OUT " \""; } print OUT escape($lines[$n]); if ($n < @lines - 1) { print OUT "\\n\"\n"; } else { print OUT "\");\n"; } } } } 07070100038c7f000081ed0000000000000000000000014c80791600001bfa0000010000010036ffffffffffffffff0000001f00000000root/usr/local/bin/intltoolize#! /bin/sh # intltoolize - Prepare a package to use intltool. # intltoolize. Generated from intltoolize.in by configure. # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Copyright (C) 2001 Eazel, Inc. # # Originally based on libtoolize by Gordon Matzigkeit , 1996 # # Modified for xml-i18n-tools by Maciej Stachowiak # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # The name of this program. progname=`echo "$0" | sed 's%^.*/%%'` # Constants. PROGRAM=intltoolize PACKAGE=intltool VERSION=0.41.1 # Directory names. prefix=/usr/local case "`uname`" in MINGW32*) # Assume intltoolize is in $prefix/bin. Strip off the script name and the "bin" prefix=`dirname $0` prefix=`dirname $prefix` ;; esac datarootdir=${prefix}/share datadir=${datarootdir} pkgdatadir=${datadir}/intltool aclocaldir=${datadir}/aclocal intltool_m4="${aclocaldir}/intltool.m4" dry_run=no help="Try '$progname --help' for more information." rm="rm -f" rm_rec="rm -rf" ln_s="ln -s" cp="cp -f" mkdir="mkdir" mkinstalldirs="mkinstalldirs" # Global variables. automake= copy= force= status=0 for arg do case "$arg" in --help) cat <&2 echo "$help" 1>&2 exit 1 ;; *) echo "$progname: too many arguments" 1>&2 echo "$help" 1>&2 exit 1 ;; esac done if test -f configure.ac; then configure="configure.ac" else if test -f configure.in; then configure="configure.in" else echo "$progname: neither 'configure.ac' nor 'configure.in' exists" 1>&2 echo "$help" 1>&2 exit 1 fi fi files='po/Makefile.in.in' if test -z "$automake"; then if egrep '^(AC|IT)_PROG_INTLTOOL' $configure >/dev/null 2>&1; then : else echo "ERROR: 'IT_PROG_INTLTOOL' must appear in $configure for intltool to work." exit 1 fi if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then updatemsg="update your 'aclocal.m4' by running aclocal" else updatemsg="add the contents of '$intltool_m4' to 'aclocal.m4'" fi if egrep '^AC_DEFUN\(\[IT_PROG_INTLTOOL\]' aclocal.m4 >/dev/null 2>&1; then # Check the version number on intltool.m4 and the one used in aclocal.m4. instserial=`grep '^# serial ' $intltool_m4 | grep 'IT_PROG_INTLTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` if test -z "$instserial"; then echo "$progname: warning: no serial number on '$intltool_m4'" 1>&2 else # If the local macro has no serial number, we assume it's ancient. localserial=`grep '^# serial ' aclocal.m4 | grep 'IT_PROG_INTLTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` test -z "$localserial" && localserial=0 if test "$localserial" -lt "$instserial"; then echo "You should $updatemsg." elif test "$localserial" -gt "$instserial"; then echo "$progname: '$intltool_m4' is serial $instserial, less than $localserial in 'aclocal.m4'" 1>&2 if test -z "$force"; then echo "Use '--force' to replace newer intltool files with this version." 1>&2 exit 1 fi echo "To remain compatible, you should $updatemsg." fi fi else echo "You should $updatemsg." fi fi # Copy or symlink the Makefile.in.in ( for file in $files; do if test -f "$file" && test -z "$force"; then test -z "$automake" && echo "$progname: '$file' exists: use '--force' to overwrite" 1>&2 continue fi $rm $file if test -n "$ln_s" && $ln_s $pkgdatadir/`basename $file` $file; then : elif $cp $pkgdatadir/`basename $file` $file; then : else echo "$progname: cannot copy '$pkgdatadir/`basename $file`' to '$file'" 1>&2 status=1 fi # Touch script names for backward compatibility for script in intltool-extract.in intltool-merge.in intltool-update.in; do # Always remove the script files now rm -f $script if egrep $script Makefile.am >/dev/null 2>&1; then touch $script fi done done exit $status # make sure this subshell exits with the exit value if it failed ) || exit $? # If the AC_CONFIG_MACRO_DIR() macro is used, copy intltool.m4 from our # prefix to that directory. This makes sure that the M4 macro used # matches the intltool scripts we install. # If AC_CONFIG_MACRO_DIR is not used, things will behave as before (aclocal # will be used to pull in the macro. m4dir=`cat "$configure" | grep '^AC_CONFIG_MACRO_DIR' | sed -n -e 's/AC_CONFIG_MACRO_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q` if test -n "$m4dir"; then rm -f $m4dir/intltool.m4 if test -n "$ln_s" && $ln_s $intltool_m4 $m4dir/intltool.m4; then : elif $cp $intltool_m4 $m4dir/intltool.m4; then : else echo "$progname: cannot copy '$intltool_m4' to '$m4dir/intltool.m4'" 1>&2 exit 1 fi fi # FIXME: This probably does not work w/ builddir != srcdir because it # gets at source files relative to the current directory. grep INTLTOOL_MAKEFILE po/Makefile.in.in >/dev/null || { echo "$progname: 'po/Makefile.in.in' is out of date: use '--force' to overwrite" exit 1 } exit $status # Local Variables: # mode:shell-script # sh-indentation:2 # End: 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!