i18n: add--interactive: mark plural strings
Mark plural strings for translation. Unfold each action case in one entire sentence. Pass new keyword for xgettext to extract. Update test to include new subroutine __n() for plural strings handling. Update documentation to include a description of the new __n() subroutine. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
901707babc
commit
c4a85c3b8e
@ -668,12 +668,18 @@ sub status_cmd {
|
||||
sub say_n_paths {
|
||||
my $did = shift @_;
|
||||
my $cnt = scalar @_;
|
||||
print "$did ";
|
||||
if (1 < $cnt) {
|
||||
print "$cnt paths\n";
|
||||
}
|
||||
else {
|
||||
print "one path\n";
|
||||
if ($did eq 'added') {
|
||||
printf(__n("added %d path\n", "added %d paths\n",
|
||||
$cnt), $cnt);
|
||||
} elsif ($did eq 'updated') {
|
||||
printf(__n("updated %d path\n", "updated %d paths\n",
|
||||
$cnt), $cnt);
|
||||
} elsif ($did eq 'reverted') {
|
||||
printf(__n("reverted %d path\n", "reverted %d paths\n",
|
||||
$cnt), $cnt);
|
||||
} else {
|
||||
printf(__n("touched %d path\n", "touched %d paths\n",
|
||||
$cnt), $cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1420,7 +1426,8 @@ sub patch_update_file {
|
||||
} elsif (0 < $response && $response <= $num) {
|
||||
$ix = $response - 1;
|
||||
} else {
|
||||
error_msg "Sorry, only $num hunks available.\n";
|
||||
error_msg sprintf(__n("Sorry, only %d hunk available.\n",
|
||||
"Sorry, only %d hunks available.\n", $num), $num);
|
||||
}
|
||||
next;
|
||||
}
|
||||
@ -1515,8 +1522,10 @@ sub patch_update_file {
|
||||
elsif ($other =~ /s/ && $line =~ /^s/) {
|
||||
my @split = split_hunk($hunk[$ix]{TEXT}, $hunk[$ix]{DISPLAY});
|
||||
if (1 < @split) {
|
||||
print colored $header_color, "Split into ",
|
||||
scalar(@split), " hunks.\n";
|
||||
print colored $header_color, sprintf(
|
||||
__n("Split into %d hunk.\n",
|
||||
"Split into %d hunks.\n",
|
||||
scalar(@split)), scalar(@split));
|
||||
}
|
||||
splice (@hunk, $ix, 1, @split);
|
||||
$num = scalar @hunk;
|
||||
|
Reference in New Issue
Block a user