Re: [PATCH v2 1/2] object.[ch]: mark object type names for translation
From: Junio C Hamano <hidden>
Date: 2021-10-07 18:07:06
Jeff King [off-list ref] writes:
On Wed, Oct 06, 2021 at 12:46:12PM -0700, Junio C Hamano wrote:quoted
Jeff King [off-list ref] writes:quoted
They all appear to want is as a noun. So maybe this is just mis-translated for Spanish. It does feel like an accident in the making, though.Probably we need pgettext(). https://www.gnu.org/software/gettext/manual/html_node/Contexts.htmlYeah, that make sense. I'm not sure how it interacts with N_(), though. I.e., I'd expect the "context" to ride along with the original string, but I guess it is really in the caller who's translating it. So the real spot becomes: printf(_("my type is %s"), pgettext("object-type", type_name(type))); It's a little unfortunate that every caller has to do it rather than putting it near the source string. But I guess a type_name_human() would solve that, too. ;)
Yes, I agree the need for pgettext() is annoying but I do not see an easy alternative. Introducing a wrapper like type_name_human() to limit the damage sounds like the best we could do. Thanks.