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

Re: [PATCH v3][Outreachy] branch -D: allow - as abbreviation of @{-1}

From
Remi Galan Alfonso <remi.galan-alfonso@ensimag.grenoble-inp.fr>
Date
Apr 4, 2016, 21:53 UTC
Message-ID
<1048705176.2897167.1459806794368.JavaMail.zimbra@ensimag.grenoble-inp.fr>
In-Reply-To
<CAJPOeMeqMpy8wmZ3jMfw_XLAS2WbPOtJF8_Rd_sPGQNeCNyFnw@mail.gmail.com>
elena petrashen <elena.petrashen@gmail.com> wrote:
Show 18 quoted lines
> On Thu, Mar 31, 2016 at 6:31 PM, Remi Galan Alfonso
> <remi.galan-alfonso@ensimag.grenoble-inp.fr> wrote:
> > Elena Petrashen <elena.petrashen@gmail.com> wrote:
> >> +void delete_branch_advice(const char *name, const char *ref)
> >> +{
> >> +        const char fmt[] =
> >> +        "\nNote: to restore the deleted branch:\n\ngit branch %s %s\n";
> >
> > Shouldn't that be marked for translation, like is done with the other
> > strings?
> >
> > Thanks,
> > Rémi
> 
> Thank you for letting me know about that! Could you please
> help me out and explain how do I mark it for translation? I tried
> to do it the same way as with the other strings but evidently
> didn't quite succeed.

I am not sure. I tried to grep similar cases, it seems that you can do the following:

	const char fmt[] = N_("\nNote: to restore [...] \ngit branch %s %s\n");
	fprintf(stderr, _(fmt), name, ref);
Some similar example in builtin/add.c:
	static const char ignore_error[] =
	N_("The following paths are ignored by one of your .gitignore files:\n");
	[...]
			fprintf(stderr, _(ignore_error));

Or you can define fmt as a 'const char *' and in that case do the following:

	const char *fmt = _("\nNote: to restore [...] \n git branch %s %s\n");
	fprintf(stderr, fmt, name, ref);
In builtin/am.c:
		const char *invalid_line = _("Malformed input line: '%s'.");
	[...]
				ret = error(invalid_line, sb.buf);
I don't know which one is the best way to go though.

Thanks, Rémi

Previous: elena petrashenNext: elena petrashen
Message 5 of 9 in “[Outreachy] branch -D: allow - as abbreviation of @{-1}”
  1. [Outreachy] branch -D: allow - as abbreviation of @{-1}Elena Petrashen, Mar 31, 2016
  2. Matthieu MoyMar 31, 2016
  3. Remi Galan AlfonsoMar 31, 2016
  4. elena petrashenApr 4, 2016
  5. Remi Galan AlfonsoApr 4, 2016
  6. elena petrashenApr 6, 2016
  7. Remi Galan AlfonsoApr 6, 2016
  8. Junio C HamanoMar 31, 2016
  9. elena petrashenApr 6, 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.