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

Re: [PATCH 2/3] i18n: Only extract comments marked by special tag

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 18, 2014, 16:52 UTC
Message-ID
<xmqqha5qd1hl.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CANYiYbGkjpdrzE25iRS33sm1=AodiREqWmJVkKVEok4mb4G5mQ@mail.gmail.com>
Jiang Xin <worldhello.net@gmail.com> writes:
Show 29 quoted lines
>> I am not very happy with this change, as it would force us to
>> special case "Translators" comment to follow a non-standard
>> multi-line comment formatting convention.  Is there a way to tell
>> xgettext to accept both of these forms?
>>
>>         /* TRANSLATORS: this is a short comment to help you */
>>         _("foo bar");
>>
>>         /*
>>          * TRANSLATORS: this comment is to help you, but it is
>>          * a lot longer to fit on just a single line.
>>          */
>>         _("bar baz");
>>
>
> We can not provide multiple `--add-comments=TAG` options to xgettext,
> because xgettext holds the tag in one string, not in a list:
>
>         /* Tag used in comment of prevailing domain.  */
>         static char *comment_tag;
>
> So if we won't change our multi-line comments for translators, must
> hack gettext in some ways.
>
> There maybe 3 ways to hack gettext:
> ...
> I CC this mail to the gettext mailing list. Full thread see:
>
>  * http://thread.gmane.org/gmane.comp.version-control.git/246390/focus=246431

This is one of these times when I find myself very fortunate for being surrounded by competent contributors with good tastes, which I may not deserve ;-)

Thanks for being thorough.

Having said that, it is only just a single comment, and it is too much hassle to even think about what to do in the meantime while we wait until such a change happens and an updated version of gettext reaches everybody. Let's take 2/3 as-is.

Documentation/CodingGuidelines may want to have a sentence of two to explain this, though.

 Documentation/CodingGuidelines | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index dab5c61..b367a85 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -159,10 +159,19 @@ For C programs:
  - Multi-line comments include their delimiters on separate lines from
    the text.  E.g.
 
 	/*
 	 * A very long
 	 * multi-line comment.
 	 */
 
+   Note however that a multi-line comment that explains a translatable
+   string to translators uses a different convention of starting with a
+   magic token "TRANSLATORS: " immediately after the opening delimiter,
+   and without an asterisk at the beginning of each line.  E.g.
+
+	/* TRANSLATORS: here is a comment that explains the string
+	   to be translated, that follows immediately after it */
+	_("Here is a translatable string explained by the above.");
+
  - Double negation is often harder to understand than no negation
    at all.
Previous: Jiang XinNext: Junio C Hamano
Message 8 of 13 in “[l10n] date: Note for translators not included in .po files”
  1. Brian GesiakApr 16, 2014
  2. Jiang XinApr 17, 2014
  3. 0/3 extract proper comments for l10n translatorsJiang Xin, Apr 17, 2014
  4. 1/3 i18n: Fixes uncatchable comments for translatorsJiang Xin, Apr 17, 2014
  5. 2/3 i18n: Only extract comments marked by special tagJiang Xin, Apr 17, 2014
  6. Junio C HamanoApr 17, 2014
  7. Jiang XinApr 18, 2014
  8. Junio C HamanoApr 18, 2014
  9. Junio C HamanoApr 18, 2014
  10. 3/3 i18n: Remove obsolete comments for translatorsJiang Xin, Apr 17, 2014
  11. Jiang XinApr 17, 2014
  12. Junio C HamanoApr 17, 2014
  13. Jiang XinApr 17, 2014

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.