git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Vasco Almeida <vascomalmeida@sapo.pt>
Cc: git@vger.kernel.org, "Jiang Xin" <worldhello.net@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH 11/11] i18n: difftool: mark warnings for translation
Date: Tue, 21 Jun 2016 21:33:29 -0700	[thread overview]
Message-ID: <20160622043329.GA31643@gmail.com> (raw)
In-Reply-To: <20160621114413.9467-11-vascomalmeida@sapo.pt>

On Tue, Jun 21, 2016 at 11:44:13AM +0000, Vasco Almeida wrote:
> --- a/git-difftool.perl
> +++ b/git-difftool.perl
> @@ -451,11 +452,11 @@ sub dir_diff
>  		}
>  
>  		if (exists $wt_modified{$file} and exists $tmp_modified{$file}) {
> -			my $errmsg = "warning: Both files modified: ";
> -			$errmsg .= "'$workdir/$file' and '$b/$file'.\n";
> -			$errmsg .= "warning: Working tree file has been left.\n";
> -			$errmsg .= "warning:\n";
> -			warn $errmsg;
> +			warn sprintf __(
> +"warning: Both files modified:
> +'%s/%s' and '%s/%s'.
> +warning: Working tree file has been left.
> +warning:\n"), $workdir, $file, $b, $file;


Sorry for the nit, but this seems a little hard to read.

It's unfortunate that we have to lose the flow of the code here.
Perhaps we can do something like this to make it flow more like
the original instead?

+			warn sprintf(__(
+				"warning: Both files modified:\n" .
+				"'%s/%s' and '%s/%s'.\n" .
+				"warning: Working tree file has been left.\n" .
+				"warning:\n"), $workdir, $file, $b, $file);

I tend to also prefer parens on the sprintf so that the
parameter grouping is easier to see.

> @@ -467,8 +468,9 @@ sub dir_diff
>  		}
>  	}
>  	if ($error) {
> -		warn "warning: Temporary files exist in '$tmpdir'.\n";
> -		warn "warning: You may want to cleanup or recover these.\n";
> +		warn sprintf __(
> +"warning: Temporary files exist in '%s'.
> +warning: You may want to cleanup or recover these.\n"), $tmpdir;

Ditto, perhaps something like...

+		warn sprintf(__(
+			"warning: Temporary files exist in '%s'.\n" .
+			"warning: You may want to cleanup or recover these.\n"
+			), $tmpdir);

I'm assuming that the i18n infrastructure is prepared to deal
with perl's . dot syntax for string concatenation, though, and
I don't know whether that's true.  Does that work?

What do you think?

ciao,
-- 
David

  reply	other threads:[~2016-06-22  4:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21 11:44 [PATCH 01/11] i18n: add--interactive: mark strings for translation Vasco Almeida
2016-06-21 11:44 ` [PATCH 02/11] i18n: add--interactive: mark simple here documents " Vasco Almeida
2016-06-21 11:44 ` [PATCH 03/11] i18n: add--interactive: mark strings with interpolation " Vasco Almeida
2016-06-21 11:44 ` [PATCH 04/11] i18n: add--interactive: mark plural strings Vasco Almeida
2016-06-21 11:44 ` [PATCH 05/11] i18n: add--interactive: mark message for translation Vasco Almeida
2016-06-21 11:44 ` [PATCH 06/11] i18n: add--interactive: i18n of help_patch_cmd Vasco Almeida
2016-06-21 11:44 ` [PATCH 07/11] i18n: add--interactive: mark edit_hunk message for translation Vasco Almeida
2016-06-21 11:44 ` [PATCH 08/11] i18n: send-email: mark strings " Vasco Almeida
2016-06-21 11:44 ` [PATCH 09/11] i18n: send-email: mark warnings and errors " Vasco Almeida
2016-06-21 11:44 ` [PATCH 10/11] i18n: send-email: mark string with interpolation " Vasco Almeida
2016-06-21 11:44 ` [PATCH 11/11] i18n: difftool: mark warnings " Vasco Almeida
2016-06-22  4:33   ` David Aguilar [this message]
2016-06-22 12:11     ` Vasco Almeida

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160622043329.GA31643@gmail.com \
    --to=davvid@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=vascomalmeida@sapo.pt \
    --cc=worldhello.net@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).