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

[PATCH v7 00/16] Mark strings in Perl scripts for translation

From
Vasco Almeida <vascomalmeida@sapo.pt>
Date
Dec 14, 2016, 12:54 UTC
Message-ID
<20161214125439.8822-1-vascomalmeida@sapo.pt>
In-Reply-To
<20161005172110.30801-1-vascomalmeida@sapo.pt>
Changes is this re-roll v7:
* Add get_comment_line_char subroutine to perl/Git.pm and use it.
* get_comment_line_char gets the value of core.commentchar configuration
  variable. It handles the 'auto' value taking '#' in this case as the
  comment line character.
* When core.commentchar is not set to one single character, take '#' as the
  comment line character. This follows the system behaviour programmed in
  config.c::git_default_core_config.
Interdiff from v6 included below.
Vasco Almeida (16):
  Git.pm: add subroutines for commenting lines
  i18n: add--interactive: mark strings for translation
  i18n: add--interactive: mark simple here-documents for translation
  i18n: add--interactive: mark strings with interpolation for
    translation
  i18n: clean.c: match string with git-add--interactive.perl
  i18n: add--interactive: mark plural strings
  i18n: add--interactive: mark patch prompt for translation
  i18n: add--interactive: i18n of help_patch_cmd
  i18n: add--interactive: mark edit_hunk_manually message for
    translation
  i18n: add--interactive: remove %patch_modes entries
  i18n: add--interactive: mark status words for translation
  i18n: send-email: mark strings for translation
  i18n: send-email: mark warnings and errors for translation
  i18n: send-email: mark string with interpolation for translation
  i18n: send-email: mark composing message for translation
  i18n: difftool: mark warnings for translation
 Makefile                  |   3 +-
 builtin/clean.c           |  10 +-
 git-add--interactive.perl | 329 ++++++++++++++++++++++++++++++----------------
 git-difftool.perl         |  22 ++--
 git-send-email.perl       | 191 +++++++++++++++------------
 perl/Git.pm               |  38 ++++++
 perl/Git/I18N.pm          |  19 ++-
 t/t0202/test.pl           |  14 +-
 8 files changed, 408 insertions(+), 218 deletions(-)
-- >8 --
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 3a6d846..4e0ab5a 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1072,7 +1072,7 @@ sub edit_hunk_manually {
 	print $fh @$oldtext;
 	my $is_reverse = $patch_mode_flavour{IS_REVERSE};
 	my ($remove_plus, $remove_minus) = $is_reverse ? ('-', '+') : ('+', '-');
-	my $comment_line_char = Git::config("core.commentchar") || '#';
+	my $comment_line_char = Git::get_comment_line_char;
 	print $fh Git::comment_lines sprintf(__ <<EOF, $remove_minus, $remove_plus, $comment_line_char),
 ---
 To remove '%s' lines, make them ' ' lines (context).
diff --git a/perl/Git.pm b/perl/Git.pm
index 69cd1dd..bfce1f7 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -1451,6 +1451,20 @@ sub prefix_lines {
 	return $string;
 }
 
+=item get_comment_line_char ( )
+
+Gets the core.commentchar configuration value.
+The value falls-back to '#' if core.commentchar is set to 'auto'.
+
+=cut
+
+sub get_comment_line_char {
+	my $comment_line_char = config("core.commentchar") || '#';
+	$comment_line_char = '#' if ($comment_line_char eq 'auto');
+	$comment_line_char = '#' if (length($comment_line_char) != 1);
+	return $comment_line_char;
+}
+
 =item comment_lines ( STRING [, STRING... ])
 
 Comments lines following core.commentchar configuration.
@@ -1458,7 +1472,7 @@ Comments lines following core.commentchar configuration.
 =cut
 
 sub comment_lines {
-	my $comment_line_char = config("core.commentchar") || '#';
+	my $comment_line_char = get_comment_line_char;
 	return prefix_lines("$comment_line_char ", @_);
 }
 
-- >8 --
-- 
2.11.0.44.g7d42c6c
Next: Vasco Almeida
Message 1 of 18 in “Mark strings in Perl scripts for translation”
  1. 00/16 Mark strings in Perl scripts for translationVasco Almeida, Dec 14, 2016
  2. 02/16 i18n: add--interactive: mark strings for translationVasco Almeida, Dec 14, 2016
  3. 06/16 i18n: add--interactive: mark plural stringsVasco Almeida, Dec 14, 2016
  4. 11/16 i18n: add--interactive: mark status words for translationVasco Almeida, Dec 14, 2016
  5. 05/16 i18n: clean.c: match string with git-add--interactive.perlVasco Almeida, Dec 14, 2016
  6. 12/16 i18n: send-email: mark strings for translationVasco Almeida, Dec 14, 2016
  7. 03/16 i18n: add--interactive: mark simple here-documents for translationVasco Almeida, Dec 14, 2016
  8. 09/16 i18n: add--interactive: mark edit_hunk_manually message for translationVasco Almeida, Dec 14, 2016
  9. 08/16 i18n: add--interactive: i18n of help_patch_cmdVasco Almeida, Dec 14, 2016
  10. 01/16 Git.pm: add subroutines for commenting linesVasco Almeida, Dec 14, 2016
  11. 10/16 i18n: add--interactive: remove %patch_modes entriesVasco Almeida, Dec 14, 2016
  12. 14/16 i18n: send-email: mark string with interpolation for translationVasco Almeida, Dec 14, 2016
  13. 07/16 i18n: add--interactive: mark patch prompt for translationVasco Almeida, Dec 14, 2016
  14. 04/16 i18n: add--interactive: mark strings with interpolation for translationVasco Almeida, Dec 14, 2016
  15. 13/16 i18n: send-email: mark warnings and errors for translationVasco Almeida, Dec 14, 2016
  16. 16/16 i18n: difftool: mark warnings for translationVasco Almeida, Dec 14, 2016
  17. 15/16 i18n: send-email: mark composing message for translationVasco Almeida, Dec 14, 2016
  18. Junio C HamanoDec 14, 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.