summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Vasco Almeida <vascomalmeida@sapo.pt>2016-12-14 11:54:27 -0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-12-14 11:00:04 -0800
commit13c58c1754393c17fb50b63ae9a3bc07195e520c (patch)
treed403356444c378feca5709bc479c7effee6612c1
parenti18n: add--interactive: mark simple here-documents for translation (diff)
downloadtgif-13c58c1754393c17fb50b63ae9a3bc07195e520c.tar.xz
i18n: add--interactive: mark strings with interpolation for translation
Since at this point Git::I18N.perl lacks support for Perl i18n placeholder substitution, use of sprintf following die or error_msg is necessary for placeholder substitution take place. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xgit-add--interactive.perl25
1 files changed, 13 insertions, 12 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 88c8d9dd6b..c1d4eb8156 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -614,12 +614,12 @@ sub list_and_choose {
else {
$bottom = $top = find_unique($choice, @stuff);
if (!defined $bottom) {
- error_msg "Huh ($choice)?\n";
+ error_msg sprintf(__("Huh (%s)?\n"), $choice);
next TOPLOOP;
}
}
if ($opts->{SINGLETON} && $bottom != $top) {
- error_msg "Huh ($choice)?\n";
+ error_msg sprintf(__("Huh (%s)?\n"), $choice);
next TOPLOOP;
}
for ($i = $bottom-1; $i <= $top-1; $i++) {
@@ -716,7 +716,7 @@ sub revert_cmd {
$_->{INDEX_ADDDEL} eq 'create') {
system(qw(git update-index --force-remove --),
$_->{VALUE});
- print "note: $_->{VALUE} is untracked now.\n";
+ printf(__("note: %s is untracked now.\n"), $_->{VALUE});
}
}
}
@@ -1053,7 +1053,7 @@ sub edit_hunk_manually {
my $hunkfile = $repo->repo_path . "/addp-hunk-edit.diff";
my $fh;
open $fh, '>', $hunkfile
- or die "failed to open hunk edit file for writing: " . $!;
+ or die sprintf(__("failed to open hunk edit file for writing: %s"), $!);
print $fh "# Manual hunk edit mode -- see bottom for a quick guide\n";
print $fh @$oldtext;
my $participle = $patch_mode_flavour{PARTICIPLE};
@@ -1080,7 +1080,7 @@ EOF
}
open $fh, '<', $hunkfile
- or die "failed to open hunk edit file for reading: " . $!;
+ or die sprintf(__("failed to open hunk edit file for reading: %s"), $!);
my @newtext = grep { !/^#/ } <$fh>;
close $fh;
unlink $hunkfile;
@@ -1233,7 +1233,7 @@ sub apply_patch_for_checkout_commit {
sub patch_update_cmd {
my @all_mods = list_modified($patch_mode_flavour{FILTER});
- error_msg "ignoring unmerged: $_->{VALUE}\n"
+ error_msg sprintf(__("ignoring unmerged: %s\n"), $_->{VALUE})
for grep { $_->{UNMERGED} } @all_mods;
@all_mods = grep { !$_->{UNMERGED} } @all_mods;
@@ -1415,7 +1415,8 @@ sub patch_update_file {
chomp $response;
}
if ($response !~ /^\s*\d+\s*$/) {
- error_msg "Invalid number: '$response'\n";
+ error_msg sprintf(__("Invalid number: '%s'\n"),
+ $response);
} elsif (0 < $response && $response <= $num) {
$ix = $response - 1;
} else {
@@ -1457,7 +1458,7 @@ sub patch_update_file {
if ($@) {
my ($err,$exp) = ($@, $1);
$err =~ s/ at .*git-add--interactive line \d+, <STDIN> line \d+.*$//;
- error_msg "Malformed search regexp $exp: $err\n";
+ error_msg sprintf(__("Malformed search regexp %s: %s\n"), $exp, $err);
next;
}
my $iy = $ix;
@@ -1622,18 +1623,18 @@ sub process_args {
$patch_mode = $1;
$arg = shift @ARGV or die __("missing --");
} else {
- die "unknown --patch mode: $1";
+ die sprintf(__("unknown --patch mode: %s"), $1);
}
} else {
$patch_mode = 'stage';
$arg = shift @ARGV or die __("missing --");
}
- die "invalid argument $arg, expecting --"
- unless $arg eq "--";
+ die sprintf(__("invalid argument %s, expecting --"),
+ $arg) unless $arg eq "--";
%patch_mode_flavour = %{$patch_modes{$patch_mode}};
}
elsif ($arg ne "--") {
- die "invalid argument $arg, expecting --";
+ die sprintf(__("invalid argument %s, expecting --"), $arg);
}
}