Re: [PATCH v2 04/11] i18n: add--interactive: mark plural strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <vascomalmeida@xxxxxxx>
> ---
>  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.
> > 
> > 



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]