summaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorVasco Almeida <vascomalmeida@sapo.pt>2016-12-14 12:54:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-14 19:00:04 (GMT)
commit13c58c1754393c17fb50b63ae9a3bc07195e520c (patch)
treed403356444c378feca5709bc479c7effee6612c1 /git-add--interactive.perl
parent5fa832640a627d6930df2194a28e9cc4aa4ef5c9 (diff)
downloadgit-13c58c1754393c17fb50b63ae9a3bc07195e520c.zip
git-13c58c1754393c17fb50b63ae9a3bc07195e520c.tar.gz
git-13c58c1754393c17fb50b63ae9a3bc07195e520c.tar.bz2
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>
Diffstat (limited to 'git-add--interactive.perl')
-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 88c8d9d..c1d4eb8 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);
}
}