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

Re: [PATCH 3 1/1] parse-options: localize mark-up of placeholder text in the short help

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 15, 2024, 15:39 UTC
Message-ID
<xmqqjzhm7jgl.fsf@gitster.g>
In-Reply-To
<CAP6f5MkGQssKyAdgN3rbzfTZtPgETaSjpm3JevuaLg-vh_pNug@mail.gmail.com>
Alexander Shopov <ash@kambanaria.org> writes:
> Will the patch for expose substitution hint chars be included in 2.46?
> Should I do anything more?

Sorry, I lost track. Did we resolve why "<>" is special and but "[]" is OK to leave out of the translatable text? IOW, is there much point in advising the translators that "<>" is something specifically they are allowed to change?

Stepping back a bit, would translators (especially for languages without any need for the ability to replace <> with something else) understand when told

    TRANSLATORS: change `<>' to other characters or leave as is

why anybody would want to change it in the first place? Stepping back even a bit more, probably making it clear to them what these instances of [<%s>], [=<%s>], etc., are doing would be sufficient to help them making the right decision?

If a translator for a hypothetical language that uses say „%s“ reads

	/* TRANSLATORS: <%s> here stands for an command line argument */
	_("<%s>")

in the comment, wouldn't that be sufficient to tell them they are allowed to change "<>" to "„“"?

Similarly, explaining [<%s>] as "optional command line argument", would tell them that it is OK for them to replace not just <> but also [] if their language requires such a change, no?

Thanks for pinging.
Show 28 quoted lines
>> diff --git a/parse-options.c b/parse-options.c
>> index 30b9e68f8a..06d962b00e 100644
>> --- a/parse-options.c
>> +++ b/parse-options.c
>> @@ -1070,11 +1070,17 @@ static int usage_argh(const struct option *opts, FILE *outfile)
>>                 !opts->argh || !!strpbrk(opts->argh, "()<>[]|");
>>         if (opts->flags & PARSE_OPT_OPTARG)
>>                 if (opts->long_name)
>> -                       s = literal ? "[=%s]" : "[=<%s>]";
>> +                       s = literal ? "[=%s]" :
>> +                         /* TRANSLATORS: change `<>' to other characters or leave as is */
>> +                         _("[=<%s>]");
>>                 else
>> -                       s = literal ? "[%s]" : "[<%s>]";
>> +                       s = literal ? "[%s]" :
>> +                         /* TRANSLATORS: change `<>' to other characters or leave as is */
>> +                         _("[<%s>]");
>>         else
>> -               s = literal ? " %s" : " <%s>";
>> +               s = literal ? " %s" :
>> +                 /* TRANSLATORS: change `<>' to other characters or leave as is */
>> +                 _(" <%s>");
>>         return utf8_fprintf(outfile, s, opts->argh ? _(opts->argh) : _("..."));
>>  }
>>
>> --
>> 2.45.2
>>
Previous: Alexander ShopovNext: Alexander Shopov
Message 12 of 16 in “[RESUBMIT 2nd] Consistency for substitution hints (i18n) 0/1]”
  1. [RESUBMIT 2nd] Consistency for substitution hints (i18n) 0/1]Alexander Shopov, Apr 21, 2024
  2. [RESUBMIT 2nd] Consistency for substitution hints (i18n) 1/1] parse-options: use localized substitution hintsAlexander Shopov, Apr 21, 2024
  3. Junio C HamanoApr 21, 2024
  4. 0/1 Allowing localized substitution hints in parse-optionsAlexander Shopov, May 25, 2024
  5. Junio C HamanoMay 27, 2024
  6. Jiang XinMay 28, 2024
  7. 1/1 parse-options: allow localized substitution hints in macrosAlexander Shopov, May 25, 2024
  8. Junio C HamanoMay 27, 2024
  9. 0/1 parse-options: localize mark-up of placeholder text in the short helpAlexander Shopov, Jul 7, 2024
  10. 1/1 parse-options: localize mark-up of placeholder text in the short helpAlexander Shopov, Jul 7, 2024
  11. Alexander ShopovJul 14, 2024
  12. Junio C HamanoJul 15, 2024
  13. 0/1 Localize mark-up of placeholder text in the short helpAlexander Shopov, Dec 28, 2024
  14. 1/1 parse-options: localize mark-up of placeholder text in the short helpAlexander Shopov, Dec 28, 2024
  15. Junio C HamanoDec 28, 2024
  16. Jiang XinDec 30, 2024

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.