Richard W.M. Jones
2010-May-12 13:29 UTC
[Libguestfs] [PATCH 0/2] Actually translate our Perl programs (RHBZ#559963).
We observed a while back that the Perl-based libguestfs tools were not being localized. In fact I've tracked this problem down to a regression some time ago and some subsequent changes we made. These two patches fix everything. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
Richard W.M. Jones
2010-May-12 13:30 UTC
[Libguestfs] [PATCH 1/2] po: Don't generate po/Makevars file and include Perl keywords (RHBZ#559963).
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html -------------- next part -------------->From f004a1bf19b512620aab60207208f2e5dacfc548 Mon Sep 17 00:00:00 2001From: Richard Jones <rjones at redhat.com> Date: Wed, 12 May 2010 14:19:50 +0100 Subject: [PATCH 1/2] po: Don't generate po/Makevars file and include Perl keywords (RHBZ#559963). I don't see a reason to autogenerate po/Makevars, and in the earlier commit which changed this file to being autogenerated we accidentally lost the special Perl keywords, copyright notice and bug reporting address. Fix all of that. This partially reverts commit febff9d2a35c4f40abbaf8943146476bdeac671e. --- .gitignore | 1 - bootstrap | 13 ------------- po/Makevars | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 po/Makevars diff --git a/.gitignore b/.gitignore index 25948fc..ae273d7 100644 --- a/.gitignore +++ b/.gitignore @@ -190,7 +190,6 @@ po/stamp-it po/stamp-po po/LINGUAS po/Makefile.in.in -po/Makevars po/Rules-quot po/boldquot.sed po/en at boldquot.header diff --git a/bootstrap b/bootstrap index 349cf1c..c2507fc 100755 --- a/bootstrap +++ b/bootstrap @@ -38,19 +38,6 @@ autopoint --force # (or worse out-of-date) macro directory. libtoolize --copy --install -# Create gettext configuration. -echo "$0: Creating po/Makevars from po/Makevars.template ..." -rm -f po/Makevars -sed ' - /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/ - /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/ - /^XGETTEXT_OPTIONS *=/{ - s/$/ \\/ - a\ - '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+} - } -' po/Makevars.template >po/Makevars - gnulib_tool=$GNULIB_SRCDIR/gnulib-tool <$gnulib_tool || exit diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..828a614 --- /dev/null +++ b/po/Makevars @@ -0,0 +1,43 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +# --keyword=__ etc are for Perl code using perl-libintl. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=__ --keyword=__x \ + $${end_of_xgettext_options+} + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Red Hat Inc. + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = -- 1.6.6.1
Richard W.M. Jones
2010-May-12 13:31 UTC
[Libguestfs] [PATCH 2/2] po: Include strings from Perl programs in the PO files (RHBZ#559963).
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora -------------- next part -------------->From 9ef11c337d88a698b2730706982f301f93b32fba Mon Sep 17 00:00:00 2001From: Richard Jones <rjones at redhat.com> Date: Wed, 12 May 2010 14:24:23 +0100 Subject: [PATCH 2/2] po: Include strings from Perl programs in the PO files (RHBZ#559963). xgettext will only recognize '*.pl' as being a Perl file (otherwise it treats it as a C file and does not correctly find any strings in it). This commit also fixes two actual bugs that xgettext found in the strings in our Perl programs. --- .gitignore | 2 ++ Makefile.am | 14 +------------- inspector/Makefile.am | 9 +++++++++ po/POTFILES.in | 24 ++++++++++++------------ tools/Makefile.am | 11 ++++++++++- tools/virt-tar | 6 ++++-- tools/virt-win-reg | 2 +- 7 files changed, 39 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index ae273d7..e92f04b 100644 --- a/.gitignore +++ b/.gitignore @@ -113,6 +113,7 @@ images/test-grep.txt.gz initramfs initramfs.timestamp inspector/virt-inspector.1 +inspector/virt-inspector.pl inspector/stamp-inspector-generator install-sh *.jar @@ -230,6 +231,7 @@ test-tool/libguestfs-test-tool test-tool/libguestfs-test-tool-helper tools/test.img tools/virt-*.1 +tools/virt-*.pl /GNUmakefile /maint.mk /build-aux diff --git a/Makefile.am b/Makefile.am index 2fde7ff..8472285 100644 --- a/Makefile.am +++ b/Makefile.am @@ -168,19 +168,7 @@ dist-hook: all-local: cd $(srcdir); \ find $(DIST_SUBDIRS) \ - -name '*.c' -o -name '*.pl' -o -name '*.pm' -o \ - -name 'virt-cat' -o \ - -name 'virt-df' -o \ - -name 'virt-edit' -o \ - -name 'virt-inspector' -o \ - -name 'virt-list-filesystems' -o \ - -name 'virt-list-partitions' -o \ - -name 'virt-ls' -o \ - -name 'virt-make-fs' -o \ - -name 'virt-rescue' -o \ - -name 'virt-resize' -o \ - -name 'virt-tar' -o \ - -name 'virt-win-reg' | \ + -name '*.c' -o -name '*.pl' -o -name '*.pm' | \ grep -v '^perl/blib/' | \ grep -v '^capitests/' | \ grep -v '^daemon/lib/' | \ diff --git a/inspector/Makefile.am b/inspector/Makefile.am index fc2bee3..e1fe44a 100644 --- a/inspector/Makefile.am +++ b/inspector/Makefile.am @@ -58,3 +58,12 @@ TESTS_ENVIRONMENT = $(XMLLINT) --noout --relaxng virt-inspector.rng endif endif + +# Make symlink from virt-inspector.pl to virt-inspector. This is just +# to keep xgettext happy since it uses the file extension to determine +# the implementation language of a file. + +all-local: virt-inspector.pl + +virt-inspector.pl: virt-inspector + ln -sf $< $@ diff --git a/po/POTFILES.in b/po/POTFILES.in index b91bde0..b2f24d0 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -84,7 +84,7 @@ fish/tilde.c fish/time.c fuse/dircache.c fuse/guestmount.c -inspector/virt-inspector +inspector/virt-inspector.pl java/com_redhat_et_libguestfs_GuestFS.c ocaml/guestfs_c.c ocaml/guestfs_c_actions.c @@ -101,14 +101,14 @@ src/guestfs-bindtests.c src/guestfs.c test-tool/helper.c test-tool/test-tool.c -tools/virt-cat -tools/virt-df -tools/virt-edit -tools/virt-list-filesystems -tools/virt-list-partitions -tools/virt-ls -tools/virt-make-fs -tools/virt-rescue -tools/virt-resize -tools/virt-tar -tools/virt-win-reg +tools/virt-cat.pl +tools/virt-df.pl +tools/virt-edit.pl +tools/virt-list-filesystems.pl +tools/virt-list-partitions.pl +tools/virt-ls.pl +tools/virt-make-fs.pl +tools/virt-rescue.pl +tools/virt-resize.pl +tools/virt-tar.pl +tools/virt-win-reg.pl diff --git a/tools/Makefile.am b/tools/Makefile.am index 9cc6139..ab14fe0 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,5 +1,5 @@ # libguestfs virt-* tools -# Copyright (C) 2009 Red Hat Inc. +# Copyright (C) 2009-2010 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -89,3 +89,12 @@ TESTS = test-virt-cat.sh \ test-virt-tar.sh endif + +# Make symlinks from virt-foo.pl to virt-foo. This is just to keep +# xgettext happy since it uses the file extension to determine the +# implementation language of a file. + +all-local: $(tools:%=virt-%.pl) + +virt-%.pl: virt-% + ln -sf $< $@ diff --git a/tools/virt-tar b/tools/virt-tar index 612b500..839ff8e 100755 --- a/tools/virt-tar +++ b/tools/virt-tar @@ -202,9 +202,11 @@ if ($mode eq "x") { } else { # $mode eq "u" $directory = pop @ARGV; $tarball = pop @ARGV; - die __"virt-tar: $tarball: file not found\n" unless -f $tarball; + die __x("virt-tar: {tarball}: file not found\n", + tarball => $tarball) unless -f $tarball; } -die __"virt-tar: $directory: directory name must start with '/' character\n" +die __x("virt-tar: {dir}: directory name must start with '/' character\n", + dir => $directory) unless substr ($directory, 0, 1) eq "/"; my @args = (\@ARGV); diff --git a/tools/virt-win-reg b/tools/virt-win-reg index 91a1673..74881b6 100755 --- a/tools/virt-win-reg +++ b/tools/virt-win-reg @@ -338,7 +338,7 @@ else { # Import mode. %hives = (); # Look in the tmpdir for all the hive files which have been - #?downloaded / modified by the import mapper, and upload + # downloaded / modified by the import mapper, and upload # each one. opendir my $dh, $tmpdir or die "$tmpdir: $!"; foreach (readdir $dh) { -- 1.6.6.1
Apparently Analagous Threads
- [PATCH 0/3] Small improvements to i18n extraction/handling
- [PATCH 1/3] Fix manpage generation in out-of-tree builds
- [PATCH 0/4 v1] Remove gettextify, implement OCaml gettext.
- [PATCH] internationalisation: Replace autopoint infrastructure with libintl-perl
- [PATCH 0/2] New inspect_list_applications2 API