From: Vasco Almeida Date: Mon, 26 Sep 2016 18:15:21 GMT Subject: Re: [PATCH v2 04/11] i18n: add--interactive: mark plural strings Message-ID: <1474913721.1035.9.camel@sapo.pt> In-Reply-To: <1472646690-9699-5-git-send-email-vascomalmeida@sapo.pt> A Qua, 31-08-2016 às 12:31 +0000, Vasco Almeida escreveu: > 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 subrotine Q__() for plural strings handling. > > > Signed-off-by: Vasco Almeida > --- >  Makefile                  |  3 ++- >  git-add--interactive.perl | 24 ++++++++++++++++-------- >  perl/Git/I18N.pm          |  4 +++- >  t/t0202/test.pl           | 11 ++++++++++- >  4 files changed, 31 insertions(+), 11 deletions(-) > > diff --git a/git-add--interactive.perl b/git-add--interactive.perl > index 4e1e857..08badfa 100755 > --- a/git-add--interactive.perl > +++ b/git-add--interactive.perl > @@ -666,12 +666,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(Q__("added one path\n", "added %d paths\n", > > +    $cnt), $cnt); > > + } elsif ($did eq 'updated') { > > + printf(Q__("updated one path\n", "updated %d paths\n", > > +    $cnt), $cnt); > > + } elsif ($did eq 'reversed') { > > + printf(Q__("reversed one path\n", "reversed %d paths\n", This should be 'reverted' not 'reversed'. > > +    $cnt), $cnt); > > + } else { > > + printf(Q__("touched one path\n", "touched %d paths\n", > > +    $cnt), $cnt); > >   } >  } When $cnt is 1 I get the following warning: Redundant argument in printf at /home/vasco/dev/local/libexec/git-core/git-add--interactive line 680. The singular form does not have a %d to consume $cnt argument to printf(). Either we find a way to suppress that warning or we change the singular form to contain %d. > @@ -1508,8 +1514,10 @@ sub patch_update_file { > ... > > - print colored $header_color, "Split into ", > > - scalar(@split), " hunks.\n"; > > + print colored $header_color, sprintf( > > + Q__("Split into %d hunk.\n", > > +     "Split into %d hunks.\n", > > +     scalar(@split)), scalar(@split)); Like we do with this. > > > >