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

Re: [PATCH v3 13/16] ref-filter: allow porcelain to translate messages in the output

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 4, 2016, 16:12 UTC
Message-ID
<xmqq7fgd73pj.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<vpqa8l9ztmd.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> I'm not sure how important it is in this case, but it was in the case of
> setup_unpack_trees_porcelain which I took inspiration from when we
> discussed this (actually, in setup_unpack_trees_porcelain, there's isn't
> any translation even in porcelain).
OK, so paraphrase:

In the most general case, we might want to have one code to issue different messages between plumbing and Porcelain; further, for Porcelain messages may or may not want to be translated.

But I suspect that all Porcelain messages should be translatable in general, so there probably is a room for simplification.

The single macro P_() approach was done without knowing that this codepath wanted the distinction between the plumbing and Porcelain.

Show 8 quoted lines
> Note that this can be worked around later by adding another function like
>
>         static const char *get_message(const char *porcelain, const char *plumbing)
>         {
>                 return use_porcelain_msg ? porcelain : plumbing;
>         }
>
> to be called with get_message(_("this ref was gone"), "gone") or so.

Yes, I think that would be a way to do this properly. And we do not have a separate "here is the list of all translatable messages" table, which is a big plus.

> In summary: both would work. No strong opinion from me, but I slightly
> prefer the version in the patch (i.e. the one I suggested IIRC) to
> Junio's version.
Yup.
Previous: Matthieu MoyNext: Karthik Nayak
Message 23 of 31 in “port branch.c to use ref-filter's printing options”
  1. 00/16 port branch.c to use ref-filter's printing optionsKarthik Nayak, Mar 30, 2016
  2. 01/16 ref-filter: implement %(if), %(then), and %(else) atomsKarthik Nayak, Mar 30, 2016
  3. 02/16 ref-filter: include reference to 'used_atom' within 'atom_value'Karthik Nayak, Mar 30, 2016
  4. Junio C HamanoMar 30, 2016
  5. 03/16 ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)Karthik Nayak, Mar 30, 2016
  6. 04/16 ref-filter: modify "%(objectname:short)" to take lengthKarthik Nayak, Mar 30, 2016
  7. 05/16 ref-filter: move get_head_description() from branch.cKarthik Nayak, Mar 30, 2016
  8. Junio C HamanoMar 30, 2016
  9. Karthik NayakApr 1, 2016
  10. 06/16 ref-filter: introduce format_ref_array_item()Karthik Nayak, Mar 30, 2016
  11. 07/16 ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreamsKarthik Nayak, Mar 30, 2016
  12. 08/16 ref-filter: add support for %(upstream:track,nobracket)Karthik Nayak, Mar 30, 2016
  13. 09/16 ref-filter: make "%(symref)" atom work with the ':short' modifierKarthik Nayak, Mar 30, 2016
  14. Junio C HamanoMar 30, 2016
  15. Karthik NayakApr 1, 2016
  16. 10/16 ref-filter: introduce symref_atom_parser()Karthik Nayak, Mar 30, 2016
  17. 11/16 ref-filter: introduce refname_atom_parser()Karthik Nayak, Mar 30, 2016
  18. 12/16 ref-filter: add support for %(refname:dir) and %(refname:base)Karthik Nayak, Mar 30, 2016
  19. 13/16 ref-filter: allow porcelain to translate messages in the outputKarthik Nayak, Mar 30, 2016
  20. Junio C HamanoMar 30, 2016
  21. Karthik NayakApr 1, 2016
  22. Matthieu MoyApr 4, 2016
  23. Junio C HamanoApr 4, 2016
  24. 14/16 branch, tag: use porcelain outputKarthik Nayak, Mar 30, 2016
  25. 15/16 branch: use ref-filter printing APIsKarthik Nayak, Mar 30, 2016
  26. 16/16 branch: implement '--format' optionKarthik Nayak, Mar 30, 2016
  27. Junio C HamanoMar 30, 2016
  28. Dennis KaarsemakerApr 1, 2016
  29. Dennis KaarsemakerApr 1, 2016
  30. Ramsay JonesApr 1, 2016
  31. Karthik NayakApr 1, 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.