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

Re: Feature Request - Better i18n support

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 9, 2023, 22:16 UTC
Message-ID
<xmqqfsad8tap.fsf@gitster.g>
In-Reply-To
<ZAnXddDN7v0AOBdm@mbp.local>
Emir SARI <emir_sari@icloud.com> writes:
> For instance, in Turkish (and in French AFAIK), percentages are indicated
> in different formats. In Turkish it precedes the number like %54. However,
> all the percentages use the standard 54%. By marking these as translatable,
> we could easily provide the correct formats.
Interesting.  Let's take a look to see how bad it is.

$ git grep '[fd]%%' \*.[ch] ':!compat/' ':!t/' apply.c: printf(" %s %.*s{%s => %s} (%d%%)\n", renamecopy, apply.c: printf(" %s %s => %s (%d%%)\n", renamecopy, apply.c: printf(" rewrite %s (%d%%)\n",

These are currently not even marked with _() to be translatable, and it should be just the matter of enclosing them in _().

If these should be translated in the first place, that is. I do not think these are originally meant to be machine parseable (it is shown as part of "git apply --summary"), but existing users may already be abusing them as such.

diff.c:				fprintf(opt->file, "%s%4d.%01d%% %.*s\n", line_prefix,

This is part of "git diff --dirstat" output. I do not think it should be translated, even though it probably is not machine parseable.

diff.c: strbuf_addf(msg, "%s%ssimilarity index %d%%", diff.c: strbuf_addf(msg, "%s%ssimilarity index %d%%", diff.c: strbuf_addf(msg, "%s%sdissimilarity index %d%%%s\n", diff.c: strbuf_addf(&sb, " %s %s (%d%%)\n",

These are part of the extended diff headers (e.g. "rename A to B with similarity index of X%") that are very much designed to be machine parseable, and cannot be touched.

diff.c:			strbuf_addf(&sb, " (%d%%)\n", similarity_index(p));

This is part of "git diff --summary" to show "rewrite", similarly to "rename" and "copy" that we saw earlier.

wt-status.c:				_("You are in a sparse checkout with %d%% of tracked files present."),

This is already marked _(translatable) and your l10n files should be able to do "%d%%" -> "%%%d" as needed.

Previous: Emir SARINext: Emir SARI
Message 2 of 7 in “Feature Request - Better i18n support”
  1. Emir SARIMar 9, 2023
  2. Junio C HamanoMar 9, 2023
  3. Emir SARIMar 9, 2023
  4. brian m. carlsonMar 9, 2023
  5. Junio C HamanoMar 9, 2023
  6. brian m. carlsonMar 9, 2023
  7. Emir SARIMay 10, 2023

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.