threads / discuss / 64191

format-patch: why are the Range-diff: and Interdiff: headers translated?

Subject: format-patch: why are the Range-diff: and Interdiff: headers translated?

## tl;dr

6 messages between Sep 23, 2025 and Sep 24, 2025.

replies: 5people: 4as markdown or json

Kristoffer Haugsbakk· Sep 23, 2025, 16:53 UTC · lore

git-format-patch(1) has had translated strings for `Range-diff:` and `Interdiff:` since they were introduced.[1][2][3]

    // Example
    _("Interdiff against v%d: ...

Is that how translated/l10n Git is supposed to to work? I get translating errors and such—that’s for the user. But a Colombian user might send out patches to an international email list. Why should their own translated UI (again, if I’m understanding l10n correctly) affect the patch output?

I found no comments on these changes.

🔗 1: https://lore.kernel.org/git/20180722095717.17912-1-sunshine@sunshineco.com/#t † 2: 688cb1c9 (Merge branch 'es/format-patch-interdiff', 2018-09-17) † 3: 881c019e (Merge branch 'es/format-patch-rangediff', 2018-09-17)

-- 
Kristoffer
Eric Sunshine· Sep 23, 2025, 18:16 UTC · re: Kristoffer Haugsbakk · lore

Re: format-patch: why are the Range-diff: and Interdiff: headers translated?

On Tue, Sep 23, 2025 at 12:54 PM Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> wrote:

Show 11 quoted lines
> git-format-patch(1) has had translated strings for `Range-diff:` and
> `Interdiff:` since they were introduced.[1][2][3]
>
>     // Example
>     _("Interdiff against v%d: ...
>
> Is that how translated/l10n Git is supposed to to work?  I get
> translating errors and such—that’s for the user.  But a Colombian user
> might send out patches to an international email list.  Why should their
> own translated UI (again, if I’m understanding l10n correctly) affect
> the patch output?

Making these translatable was deliberate. As I recall, I had been able to formulate arguments in favor of both making them translatable and making them non-translatable, though I no longer remember what those arguments were. One argument in favor may have been that (a) the titles "Interdiff" & "Range-diff" are meant for human readers, not for machine consumption, and (b) there may very well be non-English-centric projects (open-source or not) using a patch-based workflow.

I further recall that I was expecting pushback from reviewers and was surprised when there was none. Hence, those titles remained translatable in the final version.

As far as I recall, this is only the second time in the intervening years that someone has questioned why the titles are translatable. If your reason for posing this question is that you believe the titles should not be translatable and you wish to submit a patch series to rectify that, then you won't get pushback from me. Also, in support of such a proposal, I do recall (though can't find the email) that Junio once pushed back years ago against someone proposing to make the diffstat "x file changed, y insertions(+), z deletions(-)" summary translatable.

Kristoffer Haugsbakk· Sep 23, 2025, 19:59 UTC · re: Eric Sunshine · lore

Re: format-patch: why are the Range-diff: and Interdiff: headers translated?

On Tue, Sep 23, 2025, at 20:16, Eric Sunshine wrote:
Show 17 quoted lines
> On Tue, Sep 23, 2025 at 12:54 PM Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> wrote:
>> git-format-patch(1) has had translated strings for `Range-diff:` and
>> `Interdiff:` since they were introduced.[1][2][3]
>>
>>     // Example
>>     _("Interdiff against v%d: ...
>>
>> Is that how translated/l10n Git is supposed to to work?  I get
>> translating errors and such—that’s for the user.  But a Colombian user
>> might send out patches to an international email list.  Why should their
>> own translated UI (again, if I’m understanding l10n correctly) affect
>> the patch output?
>
> Making these translatable was deliberate. As I recall, I had been able
> to formulate arguments in favor of both making them translatable and
> making them non-translatable, though I no longer remember what those
> arguments were.
Thanks for quick and solid reply!
> One argument in favor may have been that (a) the titles "Interdiff" &
> "Range-diff" are meant for human readers, not for machine consumption,
> and (b) there may very well be non-English-centric projects
> (open-source or not) using a patch-based workflow.

I’m not concerned about machine-readability. My thought was that localization/l10n of this software was intended for the user themselves. And also that users might, without intending to do so necessarily, end up using localized output in contexts where they do want English strings, like on an English-language mailing list. Even though they might prefer Spanish (from my Colombian example) when using Git themselves.

But there might for all I know be Colombian/Latin American patch mailing lists where localization like this works great.

I’m not really in the natural target group for l10n Git. I might be totally missing all the use-cases here.

Show 13 quoted lines
> I further recall that I was expecting pushback from reviewers and was
> surprised when there was none. Hence, those titles remained
> translatable in the final version.
>
> As far as I recall, this is only the second time in the intervening
> years that someone has questioned why the titles are translatable. If
> your reason for posing this question is that you believe the titles
> should not be translatable and you wish to submit a patch series to
> rectify that, then you won't get pushback from me. Also, in support of
> such a proposal, I do recall (though can't find the email) that Junio
> once pushed back years ago against someone proposing to make the
> diffstat "x file changed, y insertions(+), z deletions(-)" summary
> translatable.

Oh, not at all. I don’t intend to send any patches to change something that only me (and one other person from years ago?) have questions about. These are only questions, after all (from my side anyway).

Good night!
-- 
Kristoffer Haugsbakk
Jeff King· Sep 24, 2025, 00:41 UTC · re: Kristoffer Haugsbakk · lore

Re: format-patch: why are the Range-diff: and Interdiff: headers translated?

On Tue, Sep 23, 2025 at 09:59:55PM +0200, Kristoffer Haugsbakk wrote:
Show 13 quoted lines
> I’m not concerned about machine-readability.  My thought was that
> localization/l10n of this software was intended for the user themselves.
> And also that users might, without intending to do so necessarily, end
> up using localized output in contexts where they do want English
> strings, like on an English-language mailing list.  Even though they
> might prefer Spanish (from my Colombian example) when using Git
> themselves.
> 
> But there might for all I know be Colombian/Latin American patch mailing
> lists where localization like this works great.
> 
> I’m not really in the natural target group for l10n Git.  I might be
> totally missing all the use-cases here.

I'm not a user of the l10n stuff either, so you can take my opinion with a grain of salt. But it seems obvious to me that "the language I am most comfortable using" and "the language for the project I am contributing to" might not necessarily be the same.

I'm not sure how well gettext supports this use case, though. The first one should obviously come from LANG, etc. If we added a hypothetical format.lang config option, is there a way to tell gettext to translate a string using a language string provided per-call, rather than from the environment?

I don't know that anybody is really even asking for this, so I'm not proposing to spend a lot of effort on it. But the thread made me wonder what is even possible/easy to do here.

-Peff
Ben Knoble· Sep 24, 2025, 02:08 UTC · re: Jeff King · lore

Re: format-patch: why are the Range-diff: and Interdiff: headers translated?

Show 22 quoted lines
> Le 23 sept. 2025 à 20:42, Jeff King <peff@peff.net> a écrit :
> 
> On Tue, Sep 23, 2025 at 09:59:55PM +0200, Kristoffer Haugsbakk wrote:
> 
>> I’m not concerned about machine-readability.  My thought was that
>> localization/l10n of this software was intended for the user themselves.
>> And also that users might, without intending to do so necessarily, end
>> up using localized output in contexts where they do want English
>> strings, like on an English-language mailing list.  Even though they
>> might prefer Spanish (from my Colombian example) when using Git
>> themselves.
>> 
>> But there might for all I know be Colombian/Latin American patch mailing
>> lists where localization like this works great.
>> 
>> I’m not really in the natural target group for l10n Git.  I might be
>> totally missing all the use-cases here.
> 
> I'm not a user of the l10n stuff either, so you can take my opinion with
> a grain of salt. But it seems obvious to me that "the language I am most
> comfortable using" and "the language for the project I am contributing
> to" might not necessarily be the same.
Yep. My own patches have probably come in with French titles here because I set LANG that way.
Show 9 quoted lines
> I'm not sure how well gettext supports this use case, though. The first
> one should obviously come from LANG, etc. If we added a hypothetical
> format.lang config option, is there a way to tell gettext to translate a
> string using a language string provided per-call, rather than from the
> environment?
> 
> I don't know that anybody is really even asking for this, so I'm not
> proposing to spend a lot of effort on it. But the thread made me wonder
> what is even possible/easy to do here.
I’m not asking at the moment, since it hasn’t bothered anyone. If it does and there’s a need to do something else, I’ll fix my workflow (opting in to such new config or otherwise, as the case may be).  
Jeff King· Sep 24, 2025, 05:11 UTC · re: Ben Knoble · lore

Re: format-patch: why are the Range-diff: and Interdiff: headers translated?

On Tue, Sep 23, 2025 at 10:08:42PM -0400, Ben Knoble wrote:
> Yep. My own patches have probably come in with French titles here
> because I set LANG that way.

TBH, I hadn't even noticed. I think after a while I end up just looking past stuff like:

> > Le 23 sept. 2025 à 20:42, Jeff King <peff@peff.net> a écrit :

without even reading it. I did a quick search in the archives, and yeah, one of your v2's has "Diff-intervalle contre v1". It's pretty clear what it means in context even if you don't understand any French, and I think it adds some flavor to the list. ;)

-Peff

← back to recent threads