git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 14/14] i18n: difftool: mark warnings for translation

From
Vasco Almeida <vascomalmeida@sapo.pt>
Date
Oct 5, 2016, 17:21 UTC
Message-ID
<20161005172110.30801-15-vascomalmeida@sapo.pt>
In-Reply-To
<20161005172110.30801-1-vascomalmeida@sapo.pt>
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 git-difftool.perl | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/git-difftool.perl b/git-difftool.perl
index a5790d0..8d3632e 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -22,6 +22,7 @@ use File::Path qw(mkpath rmtree);
 use File::Temp qw(tempdir);
 use Getopt::Long qw(:config pass_through);
 use Git;
+use Git::I18N;
 
 sub usage
 {
@@ -122,7 +123,7 @@ sub setup_dir_diff
 	my $i = 0;
 	while ($i < $#rawdiff) {
 		if ($rawdiff[$i] =~ /^::/) {
-			warn << 'EOF';
+			warn __ <<'EOF';
 Combined diff formats ('-c' and '--cc') are not supported in
 directory diff mode ('-d' and '--dir-diff').
 EOF
@@ -338,7 +339,7 @@ sub main
 		if (length($opts{difftool_cmd}) > 0) {
 			$ENV{GIT_DIFF_TOOL} = $opts{difftool_cmd};
 		} else {
-			print "No <tool> given for --tool=<tool>\n";
+			print __("No <tool> given for --tool=<tool>\n");
 			usage(1);
 		}
 	}
@@ -346,7 +347,7 @@ sub main
 		if (length($opts{extcmd}) > 0) {
 			$ENV{GIT_DIFFTOOL_EXTCMD} = $opts{extcmd};
 		} else {
-			print "No <cmd> given for --extcmd=<cmd>\n";
+			print __("No <cmd> given for --extcmd=<cmd>\n");
 			usage(1);
 		}
 	}
@@ -419,11 +420,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:\n" .
+				"'%s/%s' and '%s/%s'.\n" .
+				"warning: Working tree file has been left.\n" .
+				"warning:\n"), $workdir, $file, $b, $file);
 			$error = 1;
 		} elsif (exists $tmp_modified{$file}) {
 			my $mode = stat("$b/$file")->mode;
@@ -435,8 +436,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'.\n" .
+			"warning: You may want to cleanup or recover these.\n"), $tmpdir);
 		exit(1);
 	} else {
 		exit_cleanup($tmpdir, $rc);
-- 
2.7.4
Previous: Vasco AlmeidaNext: Jakub Narębski
Message 17 of 63 in “Mark strings in Perl scripts for translation”
  1. 00/14 Mark strings in Perl scripts for translationVasco Almeida, Oct 5, 2016
  2. 02/14 i18n: add--interactive: mark simple here-documents for translationVasco Almeida, Oct 5, 2016
  3. 04/14 i18n: clean.c: match string with git-add--interactive.perlVasco Almeida, Oct 5, 2016
  4. 05/14 i18n: add--interactive: mark plural stringsVasco Almeida, Oct 5, 2016
  5. Junio C HamanoOct 5, 2016
  6. 03/14 i18n: add--interactive: mark strings with interpolation for translationVasco Almeida, Oct 5, 2016
  7. Junio C HamanoOct 5, 2016
  8. 01/14 i18n: add--interactive: mark strings for translationVasco Almeida, Oct 5, 2016
  9. 06/14 i18n: add--interactive: mark patch prompt for translationVasco Almeida, Oct 5, 2016
  10. 07/14 i18n: add--interactive: i18n of help_patch_cmdVasco Almeida, Oct 5, 2016
  11. 08/14 i18n: add--interactive: mark edit_hunk_manually message for translationVasco Almeida, Oct 5, 2016
  12. 09/14 i18n: add--interactive: remove %patch_modes entriesVasco Almeida, Oct 5, 2016
  13. 10/14 i18n: add--interactive: mark status words for translationVasco Almeida, Oct 5, 2016
  14. 11/14 i18n: send-email: mark strings for translationVasco Almeida, Oct 5, 2016
  15. 12/14 i18n: send-email: mark warnings and errors for translationVasco Almeida, Oct 5, 2016
  16. 13/14 i18n: send-email: mark string with interpolation for translationVasco Almeida, Oct 5, 2016
  17. 14/14 i18n: difftool: mark warnings for translationVasco Almeida, Oct 5, 2016
  18. Jakub NarębskiOct 5, 2016
  19. 00/14 Mark strings in Perl scripts for translationVasco Almeida, Oct 10, 2016
  20. 01/14 i18n: add--interactive: mark strings for translationVasco Almeida, Oct 10, 2016
  21. Junio C HamanoOct 19, 2016
  22. Vasco AlmeidaOct 20, 2016
  23. Junio C HamanoOct 20, 2016
  24. 02/14 i18n: add--interactive: mark simple here-documents for translationVasco Almeida, Oct 10, 2016
  25. 03/14 i18n: add--interactive: mark strings with interpolation for translationVasco Almeida, Oct 10, 2016
  26. 04/14 i18n: clean.c: match string with git-add--interactive.perlVasco Almeida, Oct 10, 2016
  27. 05/14 i18n: add--interactive: mark plural stringsVasco Almeida, Oct 10, 2016
  28. Junio C HamanoOct 19, 2016
  29. Vasco AlmeidaOct 20, 2016
  30. Vasco AlmeidaOct 20, 2016
  31. Junio C HamanoOct 20, 2016
  32. 06/14 i18n: add--interactive: mark patch prompt for translationVasco Almeida, Oct 10, 2016
  33. 07/14 i18n: add--interactive: i18n of help_patch_cmdVasco Almeida, Oct 10, 2016
  34. 08/14 i18n: add--interactive: mark edit_hunk_manually message for translationVasco Almeida, Oct 10, 2016
  35. Vasco AlmeidaNov 7, 2016
  36. 09/14 i18n: add--interactive: remove %patch_modes entriesVasco Almeida, Oct 10, 2016
  37. 10/14 i18n: add--interactive: mark status words for translationVasco Almeida, Oct 10, 2016
  38. 11/14 i18n: send-email: mark strings for translationVasco Almeida, Oct 10, 2016
  39. 12/14 i18n: send-email: mark warnings and errors for translationVasco Almeida, Oct 10, 2016
  40. 13/14 i18n: send-email: mark string with interpolation for translationVasco Almeida, Oct 10, 2016
  41. 14/14 i18n: difftool: mark warnings for translationVasco Almeida, Oct 10, 2016
  42. Junio C HamanoOct 27, 2016
  43. 00/16 Mark strings in Perl scripts for translationVasco Almeida, Nov 8, 2016
  44. 02/16 i18n: add--interactive: mark strings for translationVasco Almeida, Nov 8, 2016
  45. 09/16 i18n: add--interactive: mark edit_hunk_manually message for translationVasco Almeida, Nov 8, 2016
  46. 10/16 i18n: add--interactive: remove %patch_modes entriesVasco Almeida, Nov 8, 2016
  47. 01/16 Git.pm: add subroutines for commenting linesVasco Almeida, Nov 8, 2016
  48. Junio C HamanoNov 9, 2016
  49. Vasco AlmeidaNov 9, 2016
  50. Jakub NarębskiNov 9, 2016
  51. Junio C HamanoNov 9, 2016
  52. 08/16 i18n: add--interactive: i18n of help_patch_cmdVasco Almeida, Nov 8, 2016
  53. 16/16 i18n: difftool: mark warnings for translationVasco Almeida, Nov 8, 2016
  54. 15/16 i18n: send-email: mark composing message for translationVasco Almeida, Nov 8, 2016
  55. 14/16 i18n: send-email: mark string with interpolation for translationVasco Almeida, Nov 8, 2016
  56. 13/16 i18n: send-email: mark warnings and errors for translationVasco Almeida, Nov 8, 2016
  57. 12/16 i18n: send-email: mark strings for translationVasco Almeida, Nov 8, 2016
  58. 07/16 i18n: add--interactive: mark patch prompt for translationVasco Almeida, Nov 8, 2016
  59. 11/16 i18n: add--interactive: mark status words for translationVasco Almeida, Nov 8, 2016
  60. 06/16 i18n: add--interactive: mark plural stringsVasco Almeida, Nov 8, 2016
  61. 05/16 i18n: clean.c: match string with git-add--interactive.perlVasco Almeida, Nov 8, 2016
  62. 04/16 i18n: add--interactive: mark strings with interpolation for translationVasco Almeida, Nov 8, 2016
  63. 03/16 i18n: add--interactive: mark simple here-documents for translationVasco Almeida, Nov 8, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.