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

Re: [PATCH] i18n: remove i18n from tag reflog message

From
Junio C Hamano <gitster@pobox.com>
Date
May 4, 2017, 01:35 UTC
Message-ID
<xmqqfuglcskt.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<2070499.EYhsb04HyH@cayenne>
Jean-Noël AVILA <jn.avila@free.fr> writes:
Show 17 quoted lines
> Le dimanche 30 avril 2017, 18:45:05 CEST Junio C Hamano a écrit :
>> Jean-Noel Avila <jn.avila@free.fr> writes:
>> > The building of the reflog message is using strbuf, which is not
>> > friendly with internationalization frameworks. No other reflog
>> > messages are translated right now and switching all the messages to
>> > i18n would require a major rework of the way the messages are built.
>> 
>> Thanks for spotting.  Before we declare that reflog messages are for
>> i18n, we'd need to either drop (or redesign the implementation of)
>> the "checkout -" feature, which relies on the exact phrasing of how
>> reflog entries from "git checkout" looks like.
>> 
>> Will queue and merge down to 'master' quickly.
>> 
>
> I didn't know this "side effect". Maybe adding a test against it would be 
> requiered. Unfortunately, I don't know enough of it.

Sorry, but I am not sure what "side effect" you are referring to. I am saying that in the current codebase not translating tag reflog message (i.e. your fix) is the right thing to do.

builtin/checkout.c does
		strbuf_addf(&msg, "checkout: moving from %s to %s",
			old_desc ? old_desc : "(invalid)", new->name);

when "git checkout" is used to switch from old to new branch. The above phrasing is used by sha1_name.c::grab_nth_branch_switch() to know what branch you were on, and not having _() around the message is the right thing to do, at least in the current codebase.

If somebody wants to i18n the reflog message, that needs to be done at the reading/dispaying end, I would think. Instead of being purely textual records, a new reflog format would have to be a machine parsable message-id with parameters, and the code that wants to understand the reflog record like grab_nth_branch_switch(), as opposed to show the record to the humans, would just use the machine parsable raw data, while "git reflog" and friends that format the reflog record would give the message-id to gettext and feed the parameters recorded using the result of gettext() as the format string to fprintf(), or something like that.

Previous: Jean-Noël AVILANext: Junio C Hamano
Message 7 of 9 in “i18n: remove i18n from tag reflog message”
  1. i18n: remove i18n from tag reflog messageJean-Noel Avila, Apr 29, 2017
  2. i18n patches to apply for rc2Jean-Noel Avila, Apr 30, 2017
  3. 1/2 i18n: remove i18n from tag reflog messageJean-Noel Avila, Apr 30, 2017
  4. 2/2 i18n: read-cache: Fix typoJean-Noel Avila, Apr 30, 2017
  5. Junio C HamanoMay 1, 2017
  6. Jean-Noël AVILAMay 3, 2017
  7. Junio C HamanoMay 4, 2017
  8. Junio C HamanoMay 4, 2017
  9. Ævar Arnfjörð BjarmasonMay 1, 2017

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.