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

Re: [PATCH v4] i18n: notes: mark comment for translation

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 28, 2016, 16:09 UTC
Message-ID
<xmqq1t2du4mb.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1469705175-7503-1-git-send-email-vascomalmeida@sapo.pt>
Vasco Almeida <vascomalmeida@sapo.pt> writes:
Show 9 quoted lines
> Mark comment displayed when editing a note for translation.
>
> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
> ---
>
> This patch follows the original output and Ævar Arnfjörð Bjarmason
> sugestion to remove \n from the source string in order to assure that the
> ouput layout is not change by one translator forgetting to add \n, for
> instance.

Well, that cuts both ways. A translater adding an extra \n would also break the layout, so I am not convinced that is a very good justification.

As a parameter to strbuf_add_commented_lines(), an extra or a missing \n does not really matter, though, because the whole thing is a line-oriented comment ;-)

As to the patch text, it looks like it would produce more correct output than what I queued tentatively on 'pu', so I'd replace it with this one.

Show 25 quoted lines
>  builtin/notes.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/notes.c b/builtin/notes.c
> index 0572051..f848b89 100644
> --- a/builtin/notes.c
> +++ b/builtin/notes.c
> @@ -91,7 +91,7 @@ static const char * const git_notes_get_ref_usage[] = {
>  };
>  
>  static const char note_template[] =
> -	"\nWrite/edit the notes for the following object:\n";
> +	N_("Write/edit the notes for the following object:");
>  
>  struct note_data {
>  	int given;
> @@ -179,7 +179,8 @@ static void prepare_note_data(const unsigned char *object, struct note_data *d,
>  			copy_obj_to_fd(fd, old_note);
>  
>  		strbuf_addch(&buf, '\n');
> -		strbuf_add_commented_lines(&buf, note_template, strlen(note_template));
> +		strbuf_add_commented_lines(&buf, "\n", strlen("\n"));
> +		strbuf_add_commented_lines(&buf, _(note_template), strlen(_(note_template)));
>  		strbuf_addch(&buf, '\n');
>  		write_or_die(fd, buf.buf, buf.len);
Previous: Vasco Almeida
Message 11 of 11 in “i18n: notes: mark comment for translation”
  1. i18n: notes: mark comment for translationVasco Almeida, Jul 23, 2016
  2. Junio C HamanoJul 25, 2016
  3. Vasco AlmeidaJul 26, 2016
  4. Junio C HamanoJul 26, 2016
  5. Vasco AlmeidaJul 27, 2016
  6. i18n: notes: mark comment for translationVasco Almeida, Jul 26, 2016
  7. Junio C HamanoJul 26, 2016
  8. Vasco AlmeidaJul 27, 2016
  9. Junio C HamanoJul 27, 2016
  10. i18n: notes: mark comment for translationVasco Almeida, Jul 28, 2016
  11. Junio C HamanoJul 28, 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.