diff options
author | Vasco Almeida <vascomalmeida@sapo.pt> | 2016-12-14 11:54:29 -0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-14 11:00:05 -0800 |
commit | c4a85c3b8eef8c3b37f5103870e82894d9e5e7d0 (patch) | |
tree | fc2e7d5f464935c16a249a03990f5182936a28e1 /git-add--interactive.perl | |
parent | i18n: clean.c: match string with git-add--interactive.perl (diff) | |
download | tgif-c4a85c3b8eef8c3b37f5103870e82894d9e5e7d0.tar.xz |
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>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-x | git-add--interactive.perl | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl index c1d4eb8156..04eea239a4 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -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; |