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

[PATCH v2 07/11] i18n: add--interactive: mark edit_hunk_manually message for translation

From
Vasco Almeida <vascomalmeida@sapo.pt>
Date
Jun 29, 2016, 15:09 UTC
Message-ID
<20160629150945.15015-8-vascomalmeida@sapo.pt>
In-Reply-To
<20160629150945.15015-1-vascomalmeida@sapo.pt>

Mark message of edit_hunk_manually displayed in the editing file when user chooses 'e' option. The message had to be unfolded to allow translation of the $participle verb.

Some messages end up being exactly the same for some uses cases, but left it for easier change in the future, e.g., wanting to change wording of one particular use case.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 git-add--interactive.perl | 60 ++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 49 insertions(+), 11 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index acbfa4e..235142c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1057,22 +1057,60 @@ sub edit_hunk_manually {
 	my $fh;
 	open $fh, '>', $hunkfile
 		or die sprintf(__("failed to open hunk edit file for writing: %s"), $!);
-	print $fh "# Manual hunk edit mode -- see bottom for a quick guide\n";
+	print $fh __("# Manual hunk edit mode -- see bottom for a quick guide\n");
 	print $fh @$oldtext;
-	my $participle = $patch_mode_flavour{PARTICIPLE};
 	my $is_reverse = $patch_mode_flavour{IS_REVERSE};
 	my ($remove_plus, $remove_minus) = $is_reverse ? ('-', '+') : ('+', '-');
-	print $fh <<EOF;
-# ---
-# To remove '$remove_minus' lines, make them ' ' lines (context).
-# To remove '$remove_plus' lines, delete them.
+	print $fh sprintf(__(
+"# ---
+# To remove '%s' lines, make them ' ' lines (context).
+# To remove '%s' lines, delete them.
 # Lines starting with # will be removed.
-#
-# If the patch applies cleanly, the edited hunk will immediately be
-# marked for $participle. If it does not apply cleanly, you will be given
+#"), $remove_minus, $remove_plus),
+"\n";
+	if ($patch_mode eq 'stage') {
+		print $fh __(
+"# If the patch applies cleanly, the edited hunk will immediately be
+# marked for staging. If it does not apply cleanly, you will be given
+# an opportunity to edit again. If all lines of the hunk are removed,
+# then the edit is aborted and the hunk is left unchanged.");
+	} elsif ($patch_mode eq 'stash') {
+		print $fh __(
+"# If the patch applies cleanly, the edited hunk will immediately be
+# marked for stashing. If it does not apply cleanly, you will be given
+# an opportunity to edit again. If all lines of the hunk are removed,
+# then the edit is aborted and the hunk is left unchanged.");
+	} elsif ($patch_mode eq 'reset_head') {
+		print $fh __(
+"# If the patch applies cleanly, the edited hunk will immediately be
+# marked for unstaging. If it does not apply cleanly, you will be given
+# an opportunity to edit again. If all lines of the hunk are removed,
+# then the edit is aborted and the hunk is left unchanged.");
+	} elsif ($patch_mode eq 'reset_nothead') {
+		print $fh __(
+"# If the patch applies cleanly, the edited hunk will immediately be
+# marked for applying. If it does not apply cleanly, you will be given
 # an opportunity to edit again. If all lines of the hunk are removed,
-# then the edit is aborted and the hunk is left unchanged.
-EOF
+# then the edit is aborted and the hunk is left unchanged.");
+	} elsif ($patch_mode eq 'checkout_index') {
+		print $fh __(
+"# If the patch applies cleanly, the edited hunk will immediately be
+# marked for discarding. If it does not apply cleanly, you will be given
+# an opportunity to edit again. If all lines of the hunk are removed,
+# then the edit is aborted and the hunk is left unchanged.");
+	} elsif ($patch_mode eq 'checkout_head') {
+		print $fh __(
+"# If the patch applies cleanly, the edited hunk will immediately be
+# marked for discarding. If it does not apply cleanly, you will be given
+# an opportunity to edit again. If all lines of the hunk are removed,
+# then the edit is aborted and the hunk is left unchanged.");
+	} elsif ($patch_mode eq 'checkout_nothead') {
+		print $fh __(
+"# If the patch applies cleanly, the edited hunk will immediately be
+# marked for applying. If it does not apply cleanly, you will be given
+# an opportunity to edit again. If all lines of the hunk are removed,
+# then the edit is aborted and the hunk is left unchanged.");
+	}
 	close $fh;
 
 	chomp(my $editor = run_cmd_pipe(qw(git var GIT_EDITOR)));
-- 
2.7.4
Previous: Vasco AlmeidaNext: Vasco Almeida
Message 9 of 12 in “Mark strings in perl script for translation”
  1. 00/11 Mark strings in perl script for translationVasco Almeida, Jun 29, 2016
  2. 01/11 i18n: add--interactive: mark strings for translationVasco Almeida, Jun 29, 2016
  3. 03/11 i18n: add--interactive: mark strings with interpolation for translationVasco Almeida, Jun 29, 2016
  4. 04/11 i18n: add--interactive: mark plural stringsVasco Almeida, Jun 29, 2016
  5. 02/11 i18n: add--interactive: mark simple here documents for translationVasco Almeida, Jun 29, 2016
  6. 05/11 i18n: add--interactive: mark message for translationVasco Almeida, Jun 29, 2016
  7. 06/11 i18n: add--interactive: i18n of help_patch_cmdVasco Almeida, Jun 29, 2016
  8. 08/11 i18n: send-email: mark strings for translationVasco Almeida, Jun 29, 2016
  9. 07/11 i18n: add--interactive: mark edit_hunk_manually message for translationVasco Almeida, Jun 29, 2016
  10. 09/11 i18n: send-email: mark warnings and errors for translationVasco Almeida, Jun 29, 2016
  11. 10/11 i18n: send-email: mark string with interpolation for translationVasco Almeida, Jun 29, 2016
  12. 11/11 i18n: difftool: mark warnings for translationVasco Almeida, Jun 29, 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.