diff -uNr gdm-2.2.5.4.orig/gui/acinclude.m4 gdm-2.2.5.4/gui/acinclude.m4 --- gdm-2.2.5.4.orig/acinclude.m4 Thu Jan 1 01:00:00 1970 +++ gdm-2.2.5.4/acinclude.m4 Tue Dec 2 22:38:16 2003 @@ -0,0 +1,299 @@ +## xml-i18n-tools.m4 - Configure xml-i18n-tools for the target system. -*-Shell-script-*- +## Copyright (C) 2001 Eazel, Inc. +## Author: 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. + +AC_DEFUN(XML_I18N_TOOLS_NEWER_THAN_0_9,[ true ]) + +dnl AC_PROG_XML_I18N_TOOLS([MINIMUM-VERSION [,"G2" if always using --utf8] ]) +# serial 1 AC_PROG_XML_I18N_TOOLS +AC_DEFUN(AC_PROG_XML_I18N_TOOLS, +[ + AC_DEFUN(X18T_PFORG1, dnl and -u for G2 + ifelse([$2],[G2],[ -u ], [ -p ])) + AC_DEFUN(X18T_XML_KIND, + ifelse([$2],[G2],[ -u ],[ $(XML_I18N_XML_KIND) ])) + AC_DEFUN(X18T_KEYS_KIND, + ifelse([$2],[G2],[ -u ],[ $(XML_I18N_KEYS_KIND) ])) + + XML_I18N_MERGE_DESKTOP_RULE='%.desktop: %.desktop.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -d -u X18T_PFORG1' +XML_I18N_MERGE_DIRECTORY_RULE='%.directory: %.directory.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -d -u X18T_PFORG1' + XML_I18N_MERGE_KEYS_RULE='%.keys: %.keys.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -k X18T_KEYS_KIND' + XML_I18N_MERGE_OAF_RULE='%.oaf: %.oaf.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -o -p' + XML_I18N_MERGE_PONG_RULE='%.pong: %.pong.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -x X18T_PFORG1' + XML_I18N_MERGE_SERVER_RULE='%.server: %.server.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -o -u' + XML_I18N_MERGE_SHEET_RULE='%.sheet: %.sheet.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -x -u' +XML_I18N_MERGE_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -d X18T_PFORG1' + XML_I18N_MERGE_XML_RULE='%.xml: %.xml.in $(top_builddir)/xml-i18n-merge $(wildcard $(top_srcdir)/po/*.po) ; $(top_builddir)/xml-i18n-merge $(top_srcdir)/po $< [$]@ -x X18T_XML_KIND' + +AC_SUBST(XML_I18N_MERGE_DESKTOP_RULE) +AC_SUBST(XML_I18N_MERGE_DIRECTORY_RULE) +AC_SUBST(XML_I18N_MERGE_KEYS_RULE) +AC_SUBST(XML_I18N_MERGE_OAF_RULE) +AC_SUBST(XML_I18N_MERGE_PONG_RULE) +AC_SUBST(XML_I18N_MERGE_SERVER_RULE) +AC_SUBST(XML_I18N_MERGE_SHEET_RULE) +AC_SUBST(XML_I18N_MERGE_SOUNDLIST_RULE) +AC_SUBST(XML_I18N_MERGE_XML_RULE) + +# Use the tools built into the package, not the ones that are installed. + +XML_I18N_EXTRACT='$(top_builddir)/xml-i18n-extract' +AC_SUBST(XML_I18N_EXTRACT)dnl + +XML_I18N_MERGE='$(top_builddir)/xml-i18n-merge' +AC_SUBST(XML_I18N_MERGE)dnl + +XML_I18N_UPDATE='$(top_builddir)/xml-i18n-update' +AC_SUBST(XML_I18N_UPDATE)dnl + +AC_PATH_PROG(INTLTOOL_PERL, perl) +if test -z "$INTLTOOL_PERL"; then + AC_MSG_ERROR([perl not found; required for xml-i18n-tools]) +fi +if test -z "`$INTLTOOL_PERL -v | fgrep '5.' 2> /dev/null`"; then + AC_MSG_ERROR([perl 5.x required for xml-i18n-tools]) +fi + +dnl Remove Intltool [] tags from po/POTFILES +dnl +ifdef([AC_DIVERSION_ICMDS],[ + AC_DIVERT_PUSH(AC_DIVERSION_ICMDS) + changequote(,) + mv -f po/POTFILES po/POTFILES.tmp + sed -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES + rm -f po/POTFILES.tmp + changequote([,]) + AC_DIVERT_POP() +],[ + ifdef([AC_CONFIG_COMMANDS_PRE],[ + AC_CONFIG_COMMANDS_PRE([ + changequote(,) + mv -f po/POTFILES po/POTFILES.tmp + sed -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES + rm -f po/POTFILES.tmp + changequote([,]) + ]) + ]) +]) + +dnl manually sed perl in so people don't have to put the xml-i18n-tools scripts in their +dnl AC_OUTPUT +AC_OUTPUT_COMMANDS([ +sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/xml-i18n-extract.in > xml-i18n-extract.out +if cmp -s xml-i18n-extract xml-i18n-extract.out 2>/dev/null; then + rm -f xml-i18n-extract.out +else + mv -f xml-i18n-extract.out xml-i18n-extract +fi +chmod ugo+x xml-i18n-extract +chmod u+w xml-i18n-extract + +sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/xml-i18n-merge.in > xml-i18n-merge.out +if cmp -s xml-i18n-merge xml-i18n-merge.out 2>/dev/null; then + rm -f xml-i18n-merge.out +else + mv -f xml-i18n-merge.out xml-i18n-merge +fi +chmod ugo+x xml-i18n-merge +chmod u+w xml-i18n-merge + +sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/xml-i18n-update.in > xml-i18n-update.out +if cmp -s xml-i18n-update xml-i18n-update.out 2>/dev/null; then + rm -f xml-i18n-update.out +else + mv -f xml-i18n-update.out xml-i18n-update +fi +chmod ugo+x xml-i18n-update +chmod u+w xml-i18n-update +], INTLTOOL_PERL=${INTLTOOL_PERL}) + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +dnl old names +AC_DEFUN(AM_PROG_XML_I18N_TOOLS, [indir([AC_PROG_XML_I18N_TOOLS])])dnl +# Configure paths for ESD +# Manish Singh 98-9-30 +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS +dnl +AC_DEFUN(AM_PATH_ESD, +[dnl +dnl Get the cflags and libraries from the esd-config script +dnl +AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)], + esd_prefix="$withval", esd_prefix="") +AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)], + esd_exec_prefix="$withval", esd_exec_prefix="") +AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program], + , enable_esdtest=yes) + + if test x$esd_exec_prefix != x ; then + esd_args="$esd_args --exec-prefix=$esd_exec_prefix" + if test x${ESD_CONFIG+set} != xset ; then + ESD_CONFIG=$esd_exec_prefix/bin/esd-config + fi + fi + if test x$esd_prefix != x ; then + esd_args="$esd_args --prefix=$esd_prefix" + if test x${ESD_CONFIG+set} != xset ; then + ESD_CONFIG=$esd_prefix/bin/esd-config + fi + fi + + AC_PATH_PROG(ESD_CONFIG, esd-config, no) + min_esd_version=ifelse([$1], ,0.2.5,$1) + AC_MSG_CHECKING(for ESD - version >= $min_esd_version) + no_esd="" + if test "$ESD_CONFIG" = "no" ; then + no_esd=yes + else + ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` + ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` + + esd_major_version=`$ESD_CONFIG $esd_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + esd_minor_version=`$ESD_CONFIG $esd_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_esdtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $ESD_CFLAGS" + LIBS="$LIBS $ESD_LIBS" +dnl +dnl Now check if the installed ESD is sufficiently new. (Also sanity +dnl checks the results of esd-config to some extent +dnl + rm -f conf.esdtest + AC_TRY_RUN([ +#include +#include +#include +#include + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.esdtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_esd_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_esd_version"); + exit(1); + } + + if (($esd_major_version > major) || + (($esd_major_version == major) && ($esd_minor_version > minor)) || + (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); + printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); + printf("*** to point to the correct copy of esd-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_esd" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$ESD_CONFIG" = "no" ; then + echo "*** The esd-config script installed by ESD could not be found" + echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the ESD_CONFIG environment variable to the" + echo "*** full path to esd-config." + else + if test -f conf.esdtest ; then + : + else + echo "*** Could not run ESD test program, checking why..." + CFLAGS="$CFLAGS $ESD_CFLAGS" + LIBS="$LIBS $ESD_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding ESD or finding the wrong" + echo "*** version of ESD. If it is not finding ESD, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means ESD was incorrectly installed" + echo "*** or that you have moved ESD since it was installed. In the latter case, you" + echo "*** may want to edit the esd-config script: $ESD_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + ESD_CFLAGS="" + ESD_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(ESD_CFLAGS) + AC_SUBST(ESD_LIBS) + rm -f conf.esdtest +]) diff -ur gdm-2.2.5.4.orig/gui/gdmconfig.desktop.in gdm-2.2.5.4/gui/gdmconfig.desktop.in --- gdm-2.2.5.4.orig/gui/gdmconfig.desktop.in Thu May 3 22:22:22 2001 +++ gdm-2.2.5.4/gui/gdmconfig.desktop.in Fri Jan 2 15:19:42 2004 @@ -4,5 +4,7 @@ TryExec=gdmconfig Exec=gdmconfig Icon=gdm.xpm -Terminal=0 +Terminal=false Type=Application +Encoding=UTF-8 +# vi: encoding=utf-8 diff -ur gdm-2.2.5.4.orig/gui/gdmflexiserver-xnest.desktop.in gdm-2.2.5.4/gui/gdmflexiserver-xnest.desktop.in --- gdm-2.2.5.4.orig/gui/gdmflexiserver-xnest.desktop.in Sun Aug 19 03:15:09 2001 +++ gdm-2.2.5.4/gui/gdmflexiserver-xnest.desktop.in Fri Jan 2 15:19:37 2004 @@ -6,5 +6,7 @@ TryExec=Xnest Exec=gdmflexiserver --xnest Icon= -Terminal=0 +Terminal=false Type=Application +Encoding=UTF-8 +# vi: encoding=utf-8 diff -ur gdm-2.2.5.4.orig/gui/gdmflexiserver.desktop.in gdm-2.2.5.4/gui/gdmflexiserver.desktop.in --- gdm-2.2.5.4.orig/gui/gdmflexiserver.desktop.in Wed Aug 22 14:06:11 2001 +++ gdm-2.2.5.4/gui/gdmflexiserver.desktop.in Fri Jan 2 15:19:40 2004 @@ -3,5 +3,7 @@ _Comment=Log in as another user without loging out Exec=gdmflexiserver Icon= -Terminal=0 +Terminal=false Type=Application +Encoding=UTF-8 +# vi: encoding=utf-8 diff -ur gdm-2.2.5.4.orig/gui/gdmphotosetup.desktop.in gdm-2.2.5.4/gui/gdmphotosetup.desktop.in --- gdm-2.2.5.4.orig/gui/gdmphotosetup.desktop.in Fri May 18 00:43:06 2001 +++ gdm-2.2.5.4/gui/gdmphotosetup.desktop.in Fri Jan 2 15:19:43 2004 @@ -4,5 +4,7 @@ TryExec=gdmphotosetup Exec=gdmphotosetup Icon= -Terminal=0 +Terminal=false Type=Application +Encoding=UTF-8 +# vi: encoding=utf-8 diff -ur gdm-2.2.5.5/xml-i18n-extract.in~ gdm-2.2.5.5/xml-i18n-extract.in --- gdm-2.2.5.5/xml-i18n-extract.in~ Sat Jan 3 15:21:06 2004 +++ gdm-2.2.5.5/xml-i18n-extract.in Sat Jan 3 15:21:06 2004 @@ -1,39 +1,45 @@ -#!@XML_I18N_TOOLS_PERL@ -w +#!@INTLTOOL_PERL@ -w # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- # -# The XML Translation Extractor +# The Intltool Message Extractor # -# Copyright (C) 2000 Free Software Foundation. +# Copyright (C) 2000-2001 Free Software Foundation. # -# This library is free software; you can redistribute it and/or +# 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. # -# This script is distributed in the hope that it will be useful, +# 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 library; if not, write to the Free Software +# 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 +# Darin Adler # ## Release information -my $PROGRAM = "xml-i18n-extract"; -my $PACKAGE = "xml-i18n-tools"; -my $VERSION = "0.9"; +my $PROGRAM = "intltool-extract"; +my $PACKAGE = "intltool"; +my $VERSION = "0.11.1"; ## Script options - Enable by setting value to 1 -my $ENABLE_INI = "1"; ## desktop and alike files -my $ENABLE_KEYS = "1"; ## mimetype descriptions -my $ENABLE_GLADE = "1"; ## glade files -my $ENABLE_XML = "1"; ## generic xml files +my $ENABLE_INI = "1"; ## desktop and alike files +my $ENABLE_KEYS = "1"; ## mimetype descriptions +my $ENABLE_GLADE = "1"; ## glade files +my $ENABLE_XML = "1"; ## generic xml files +my $ENABLE_SCHEME = "1"; ## scheme files ## Loaded modules use strict; @@ -55,6 +61,9 @@ my $input; my %messages = (); +## Use this instead of \w for XML files to handle more possible characters. +my $w = "[-A-Za-z0-9._:]"; + ## Always print first $| = 1; @@ -62,7 +71,7 @@ GetOptions ( "type=s" => \$TYPE_ARG, "local|l" => \$LOCAL_ARG, - "help|h|?" => \$HELP_ARG, + "help|h" => \$HELP_ARG, "version|v" => \$VERSION_ARG, "update" => \$UPDATE_ARG, "quiet|q" => \$QUIET_ARG, @@ -145,7 +154,6 @@ ## Sub for printing error messages sub error{ -# print "xml-i18n-extract: invalid option @ARGV\n"; print "Try `${PROGRAM} --help' for more information.\n"; exit; } @@ -180,6 +188,7 @@ &type_keys; &type_xml; &type_glade; + &type_scheme; } sub type_ini { @@ -219,12 +228,16 @@ if ($gettext_type eq "xml"){ - while ($input =~ /[\t\n\s]_\w+=\"([^\"]+)\"/sg) { + while ($input =~ /[\t\n\s]_$w+=\"([^\"]+)\"/sg) { $messages{$1} = []; } - while ($input =~ /<_(\w+)>([^<]+)<\/_\1>/sg) { - $messages{$2} = []; + while ($input =~ /<_($w+)>([^<]+)<\/_\1>/sg) { + $_ = $2; + s/\s+/ /g; + s/^ //; + s/ $//; + $messages{$_} = []; } } @@ -240,7 +253,7 @@ if ($gettext_type eq "glade"){ my $translate = "label|title|text|format|copyright|comments| - preview_text|tooltip"; + preview_text|tooltip|message"; while ($input =~ /<($translate)>([^<]+)<\/($translate)>/sg) { @@ -264,6 +277,21 @@ } +sub type_scheme { + + if ($ENABLE_SCHEME) { + + ### For translatable scheme files ### + + if ($gettext_type eq "scheme"){ + + while ($input =~ /_\(?"((?:[^"\\]+|\\.)*)"\)?/sg) { + $messages{$1} = []; + } + } + } +} + sub msg_write { foreach my $message (sort keys %messages) { diff -ur gdm-2.2.5.5/xml-i18n-merge.in~ gdm-2.2.5.5/xml-i18n-merge.in --- gdm-2.2.5.5/xml-i18n-merge.in~ Sat Jan 3 15:21:07 2004 +++ gdm-2.2.5.5/xml-i18n-merge.in Sat Jan 3 15:21:07 2004 @@ -1,35 +1,41 @@ -#!@XML_I18N_TOOLS_PERL@ -w +#!@INTLTOOL_PERL@ -w # -# The XML Translation Merge Tool +# The Intltool Message Merger # # Copyright (C) 2000 Free Software Foundation. # Copyright (C) 2000, 2001 Eazel, Inc # -# This library is free software; you can redistribute it and/or +# 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. # -# This script is distributed in the hope that it will be useful, +# 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 library; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -# Authors: Maciej Stachowiak +# 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 +# Darin Adler +# +# Proper XML UTF-8ification written by Cyrille Chepelov # - ## Release information -my $PROGRAM = "xml-i18n-merge"; -my $PACKAGE = "xml-i18n-tools"; -my $VERSION = "0.9"; +my $PROGRAM = "intltool-merge"; +my $PACKAGE = "intltool"; +my $VERSION = "0.11.1"; ## Script options - Enable by setting value to 1 my $ENABLE_XML = "1"; @@ -40,24 +46,27 @@ use Getopt::Long; ## Scalars used by the option stuff -my $HELP_ARG = "0"; +my $HELP_ARG = "0"; my $VERSION_ARG = "0"; my $OAF_STYLE_ARG = "0"; my $XML_STYLE_ARG = "0"; my $KEYS_STYLE_ARG = "0"; my $DESKTOP_STYLE_ARG = "0"; my $QUIET_ARG = "0"; - +my $PASS_THROUGH_ARG = "0"; +my $UTF8_ARG = "0"; ## Handle options GetOptions ( - "help|h|?" => \$HELP_ARG, + "help|h" => \$HELP_ARG, "version|v" => \$VERSION_ARG, "quiet|q" => \$QUIET_ARG, "oaf-style|o" => \$OAF_STYLE_ARG, "xml-style|x" => \$XML_STYLE_ARG, "keys-style|k" => \$KEYS_STYLE_ARG, - "desktop-style|d" => \$DESKTOP_STYLE_ARG + "desktop-style|d" => \$DESKTOP_STYLE_ARG, + "pass-through|p" => \$PASS_THROUGH_ARG, + "utf8|u" => \$UTF8_ARG ) or &error; @@ -69,6 +78,10 @@ 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._:]"; + + &split_on_argument; @@ -79,7 +92,6 @@ if ($VERSION_ARG) { &version; - } elsif ($HELP_ARG) { &help; } elsif ($OAF_STYLE_ARG && @ARGV > 2) { @@ -88,11 +100,13 @@ &preparation; &oaf_merge_translations; } elsif ($XML_STYLE_ARG && @ARGV > 2) { + &utf8_sanity_check; &place_normal; &message; &preparation; &xml_merge_translations; } elsif ($KEYS_STYLE_ARG && @ARGV > 2) { + &utf8_sanity_check; &place_normal; &message; &preparation; @@ -107,6 +121,13 @@ } } +sub utf8_sanity_check { + if (!$UTF8_ARG) { + if (!$PASS_THROUGH_ARG) { + $PASS_THROUGH_ARG="1"; + } + } +} sub place_normal { $PO_DIR = $ARGV[0]; @@ -136,16 +157,18 @@ print " -q, --quiet quiet mode\n"; print " -o, --oaf-style includes translations in the oaf style\n"; print " -x, --xml-style includes translations in the xml style\n"; - print " -k, --keys-style includes translations in the keys style\n"; + print " -k, --keys-style includes translations in the keys style\n"; print " -d, --desktop-style includes translations in the desktop style\n"; - print "\nReport bugs to .\n"; + print " -u, --utf8 convert all strings to UTF-8 before merging\n"; + print " -p, --pass-through use strings as found in .po files, without\n"; + print " conversion (STRONGLY unrecommended with -x)\n"; + print "\nReport bugs to bugzilla.gnome.org, module intltool or xml-i18n-tools-list\@gnome.org>\n"; exit; } ## Sub for printing error messages sub error{ -# print "xml-i18n-merge: invalid option @ARGV\n"; print "Try `${PROGRAM} --help' for more information.\n"; exit; } @@ -156,7 +179,6 @@ } - sub preparation { &gather_po_files; &create_translation_database; @@ -184,6 +206,28 @@ return $tmp; } +sub get_po_encoding +{ + my ($in_po_file) = @_; + my $encoding = ""; + + open IN_PO_FILE, $in_po_file; + + 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 ("Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n"); + $encoding = "ISO-8859-1"; + } + return $encoding +} sub create_translation_database { @@ -191,18 +235,23 @@ my $po_file = $po_files_by_lang{$lang}; - open PO_FILE, "<$po_file"; + if ($UTF8_ARG) { + my $encoding = get_po_encoding($po_file); + open PO_FILE, "iconv -f $encoding -t UTF-8 $po_file|"; + } else { + open PO_FILE, "<$po_file"; + } while () { if (/^#,.*fuzzy/) { $_ = ; next; } if (/^msgid "(.*)"/ ) { - my $msgid = $1; + my $msgid = unescape_po_string($1); $_ = ; if (/^msgstr "(.+)"/) { - my $msgstr = $1; + my $msgstr = unescape_po_string($1); $translations{$lang . "|" . $msgid} = $msgstr; # print "[$lang]$msgstr\n"; } @@ -211,6 +260,28 @@ } } +sub unescape_one_sequence +{ + my ($sequence) = @_; + + return "\\" if $sequence eq "\\\\"; + return "\"" if $sequence eq "\\\""; + + # gettext also handles \n, \t, \b, \r, \f, \v, \a, \xxx (octal), + # \xXX (hex) and has a comment saying they want to handle \u and \U. + + return $sequence; +} + +sub unescape_po_string +{ + my ($string) = @_; + + $string =~ s/(\\.)/unescape_one_sequence($1)/eg; + + return $string; +} + sub lookup_translations { my ($value) = @_; @@ -260,16 +331,30 @@ { my ($pre_encoded) = @_; - $pre_encoded =~ s/\\(.)/$1/g; my @list_of_chars = unpack ('C*', $pre_encoded); - return join ('', map (&entity_encode_int, @list_of_chars)); + if ($PASS_THROUGH_ARG) { + return join ('', map (&entity_encode_int_even_high_bit, @list_of_chars)); + } else { + return join ('', map (&entity_encode_int_minimalist, @list_of_chars)); + } +} + +sub entity_encode_int_minimalist +{ + if ($_ == 34) { return """ } + elsif ($_ == 38) { return "&" } + elsif ($_ == 39) { return "'" } + elsif ($_ == 60) { return "<" } + elsif ($_ == 62) { return ">" } + return chr $_; } -sub entity_encode_int +sub entity_encode_int_even_high_bit { - if ($_ > 127 || $_ == 34 || $_ == 38) { - return "&#" . $_ . ";"; + if ($_ > 127 || $_ == 34 || $_ == 38 || $_ == 39 || $_ == 60 || $_ == 62) { + # the ($_ > 127) should probably be removed + return "&#" . $_ . ";"; } else { return chr $_; } @@ -290,18 +375,18 @@ open OUTPUT, ">$OUTFILE"; - while ($xml_source =~ /[ \t]*<[^<]*\s_\w+="[^"]*"[^<]*>/m) { - print OUTPUT $`; + while ($xml_source =~ /[ \t]*<[^<]*\s_$w+="[^"]*"[^<]*>/m) { #" + print OUTPUT $`; #` my $orig_node = $&; - $xml_source = $'; + $xml_source = $'; #' my $non_translated_line = $orig_node; - $non_translated_line =~ s/_(\w+)="/$1="/; + $non_translated_line =~ s/_($w+)="/$1="/; my $new_node = $non_translated_line; my $value_str = $orig_node; - $value_str =~ s/.*_\w+="([^"]*)".*/$1/s; + $value_str =~ s/.*_$w+="([^"]*)".*/$1/s; #" if ($value_str) { my %value_translation_map = entity_encode_translations @@ -312,7 +397,7 @@ my $translated_line = $orig_node; $translated_line =~ s/name="([^"]*)"/name="$1-$key"/; - $translated_line =~ s/(\s*)_(\w+)="[^"]*"/$1$2="$translation"/; + $translated_line =~ s/(\s*)_($w+)="[^"]*"/$1$2="$translation"/; $new_node .= "\n$translated_line"; } @@ -345,22 +430,25 @@ # First just unmark for translation all empty nodes # for example <_foo/> is just replaced by - $xml_source =~ s/<_(\w+)\/>/<$1\/>/mg; + $xml_source =~ s|<_($w+)/>|<$1/>|mg; - # Support for XML <_foo>blah style translations - while ($xml_source =~ /([ \t]*)<_(\w+)>([^<]+)<\/_\2>/m) { + # Support for <_foo>blah style translations + while ($xml_source =~ m|([ \t]*)<_($w+)>(.*?)|s) { print OUTPUT $`; - $xml_source = $'; + my $remainder = $'; #' my $spaces = $1; my $tag_name = $2; my $value_str = $3; my $non_translated_line = "$spaces<$tag_name>$value_str"; - my $new_node = $non_translated_line; if ($value_str) { + $value_str =~ s/\s+/ /g; + $value_str =~ s/^ //; + $value_str =~ s/ $//; + my %value_translation_map = entity_encode_translations (lookup_translations ($value_str)); @@ -371,7 +459,7 @@ } } - $xml_source = $new_node . $xml_source; + $xml_source = $new_node . $remainder; } print OUTPUT $xml_source; @@ -421,7 +509,6 @@ sub desktop_merge_translations { open INPUT, "<${FILE}"; - open OUTPUT, ">${OUTFILE}"; while () { diff -ur gdm-2.2.5.5/xml-i18n-update.in~ gdm-2.2.5.5/xml-i18n-update.in --- gdm-2.2.5.5/xml-i18n-update.in~ Sat Jan 3 15:21:07 2004 +++ gdm-2.2.5.5/xml-i18n-update.in Sat Jan 3 15:21:07 2004 @@ -1,29 +1,34 @@ -#!@XML_I18N_TOOLS_PERL@ -w +#!@INTLTOOL_PERL@ -w -# The GNOME Translation Update Tool +# The Intltool Message Updater # # Copyright (C) 2000 Free Software Foundation. # -# This library is free software; you can redistribute it and/or +# 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. # -# This script is distributed in the hope that it will be useful, +# 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 library; if not, write to the Free Software +# 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. +# # Author(s): Kenneth Christiansen ## Release information -my $PROGRAM = "xml-i18n-update"; -my $VERSION = "0.9"; -my $_PACKAGE = "xml-i18n-tools"; +my $PROGRAM = "intltool-update"; +my $VERSION = "0.11.1"; +my $_PACKAGE = "intltool"; ## Loaded modules use strict; @@ -50,6 +55,7 @@ "xml(\.in)*|". # .in is not required "ui|". "glade(\.in)*|". # .in is not required +"scm(\.in)*|". # .in is not required "desktop(\.in)+|". "directory(\.in)+|". "soundlist(\.in)+|". @@ -57,6 +63,7 @@ "oaf(\.in)+|". "server(\.in)+|". "etspec|". +"sheet(\.in)+|". "pong(\.in)+"; my $PACKAGE = &find_package_name; @@ -73,7 +80,7 @@ ## Handle options GetOptions ( - "help|h|?" => \$HELP_ARG, + "help|h" => \$HELP_ARG, "version|v" => \$VERSION_ARG, "dist|d" => \$DIST_ARG, "pot|p" => \$POT_ARG, @@ -153,7 +160,7 @@ if ($type =~ /\[type: (gettext\/[^\]].*)]/) { $gettext_type=$1; } - elsif ($type =~ /(?:xml(\.in)*|ui|oaf(?:\.in)+|pong(?:\.in)+|etspec)$/) { + elsif ($type =~ /(?:xml(\.in)*|ui|oaf(?:\.in)+|server(?:\.in)+|sheet(?:\.in)+|pong(?:\.in)+|etspec)$/) { $gettext_type="gettext\/xml"; } elsif ($type =~ /glade(\.in)*$/) { @@ -162,6 +169,9 @@ elsif ($type =~ /(?:desktop(?:\.in)+|directory(?:\.in)+|soundlist(?:\.in)+)$/) { $gettext_type="gettext\/ini"; } + elsif ($type =~ /scm(\.in)*$/) { + $gettext_type="gettext\/scheme"; + } elsif ($type =~ /keys(\.in)+$/) { $gettext_type="gettext\/keys"; } @@ -216,7 +226,7 @@ find sub { push @buf_i18n_xml, "$File::Find::name" if /\.($xml_extension)$/ }, ".."; open(POTFILES, "POTFILES.in") || die "$PROGRAM: there's no POTFILES.in!!!\n"; - @buf_potfiles = ; + @buf_potfiles = grep /^[^#]/, ; print "Searching for missing translatable files...\n"; @@ -297,17 +307,17 @@ sub gen_headers { - my $XML_I18N_EXTRACT = `which xml-i18n-extract 2>/dev/null`; - chomp $XML_I18N_EXTRACT; + my $EXTRACT = `which intltool-extract 2>/dev/null`; + chomp $EXTRACT; - $XML_I18N_EXTRACT = $ENV{"XML_I18N_EXTRACT"} if $ENV{"XML_I18N_EXTRACT"}; + $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} if $ENV{"INTLTOOL_EXTRACT"}; ## Generate the .h header files, so we can allow glade and ## xml translation support - if (! -s $XML_I18N_EXTRACT) + if (! -s $EXTRACT) { - print "\n *** The xml-i18n-extract script wasn't found!" - ."\n *** Without this xml-i18n-update can not generate files.\n"; + print "\n *** The intltool-extract script wasn't found!" + ."\n *** Without this intltool-update can not generate files.\n"; exit; } else @@ -317,7 +327,7 @@ chomp; ## Find xml files in POTFILES.in and generate the - ## files with help from the xml-i18n-extract script + ## files with help from the extract script my $gettext_type=&determine_type($1); @@ -326,9 +336,9 @@ my $filename = "../$_"; if ($VERBOSE){ - system($XML_I18N_EXTRACT, "--update", "--type=$gettext_type", $filename); + system($EXTRACT, "--update", "--type=$gettext_type", $filename); } else { - system($XML_I18N_EXTRACT, "--update", "--type=$gettext_type", "--quiet", $filename); + system($EXTRACT, "--update", "--type=$gettext_type", "--quiet", $filename); } } } @@ -358,7 +368,7 @@ ."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)"; system("xgettext", "--default-domain\=$PACKAGE", "--directory\=\.\.", - "--add-comments", "--keyword\=\_", "--keyword\=N\_", + "--add-comments", "--keyword\=\_", "--keyword\=N\_", "--keyword\=U\_", "--files-from\=\.\/POTFILES\.in"); system($gettext_test);