diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2005-07-18 22:15:26 +0000 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2005-07-18 22:15:26 +0000 |
commit | 748a4de99a5276a08490f379486a126e91385219 (patch) | |
tree | b97d5af033e63b4dd94f06567530ccf8be3f525f /scripts/parse-patch.in | |
parent | bf3764a7da111bb34aa430f62eac0b15c738b8e9 (diff) | |
download | quilt-748a4de99a5276a08490f379486a126e91385219.tar.gz |
- Add internationalization support to Perl scripts as well.
Diffstat (limited to 'scripts/parse-patch.in')
-rw-r--r-- | scripts/parse-patch.in | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/scripts/parse-patch.in b/scripts/parse-patch.in index 56c3c55..6441b82 100644 --- a/scripts/parse-patch.in +++ b/scripts/parse-patch.in @@ -12,15 +12,25 @@ use FileHandle; use Getopt::Long; use File::Temp qw(tempfile); +use POSIX qw(setlocale); +use Locale::gettext; use strict; +setlocale(LC_MESSAGES, ""); +bindtextdomain("quilt", "@LOCALEDIR@"); +textdomain("quilt"); + +sub _($) { + return gettext(shift); +} + my $select; my $update; if (!GetOptions("s|select=s" => \$select, "u|update=s" => \$update) || (!defined $select && !defined $update)) { - print STDERR "USAGE: $0 {-s|-u} section file [< replacement]\n"; + print STDERR sprintf(_("USAGE: %s {-s|-u} section file [< replacement]\n"), $0); exit 1; } @@ -66,13 +76,15 @@ foreach my $arg (@ARGV) { if ($arg =~ /\.gz$/) { $fh2->close(); if (! -e $tempname) { - die "File $tempname disappeared!\n"; + die sprintf( +_("File %s disappeared!\n"), $tempname); } $fh2 = new FileHandle("| gzip -c > $tempname"); } elsif ($arg =~ /\.bz2$/) { $fh2->close(); if (! -e $tempname) { - die "File $tempname disappeared!\n"; + die sprintf( +_("File %s disappeared!\n"), $tempname); } $fh2 = new FileHandle("| bzip2 -c > $tempname"); } @@ -117,12 +129,14 @@ foreach my $arg (@ARGV) { if (-e $arg) { unlink "$arg~"; unless (rename $arg, "$arg~") { - die "Failed to rename $arg to $arg~: $!\n"; + die sprintf( +_("Failed to rename %s to %s: %s\n"), $arg, "$arg~", $!); } } unless (rename $tempname, $arg) { rename("$arg~", $arg); - die "Failed to rename $arg.parse to $arg: $!\n"; + die sprintf( +_("Failed to rename %s to %s: %s\n"), $tempname, $arg, $!); } } close $fh; |