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

Re: [PATCH] i18n: Not add stripped contents for translation

From
Jiang Xin <worldhello.net@gmail.com>
Date
Mar 5, 2012, 03:01 UTC
Message-ID
<CANYiYbGdJ0yFmPnsK_JdABwmFraVdNi08QgFKRmGzJt-DA9tBw@mail.gmail.com>
In-Reply-To
<7v7gyz7pei.fsf@alter.siamese.dyndns.org>
2012/3/5 Junio C Hamano <gitster@pobox.com>:
Show 5 quoted lines
>> If the translations won't end with COMMA+SPACE, will break the integrity
>> of the concatenate string. As for Chinese, COMMA+SPACE may translated to
>> "," -- a 3-byte UTF-8 Chinese comma character.
>
> Hmph.  Why would that be a bad thing in the first place?
Orignal source code:

244 case WT_STATUS_CHANGED: 245 if (d->new_submodule_commits || d->dirty_submodule) { 246 strbuf_addstr(&extra, " ("); 247 if (d->new_submodule_commits) 248 strbuf_addf(&extra, _("new commits, ")); 249 if (d->dirty_submodule & DIRTY_SUBMODULE_MODIFIED) 250 strbuf_addf(&extra, _("modified content, ")); 251 if (d->dirty_submodule & DIRTY_SUBMODULE_UNTRACKED) 252 strbuf_addf(&extra, _("untracked content, ")); 253 strbuf_setlen(&extra, extra.len - 2); 254 strbuf_addch(&extra, ')'); 255 }

The bad thing is strbuf_setlen() at line 253. We can not asume the translation of ", " must be 2 characters.

If we change line 253 like the following, it may work but introduce another string ", " for translation, and it looks weird.

253       strbuf_setlen(&extra, extra.len - strlen( _(", ") ));

It is because I translate the ", " to "," (chinese comma), the translated chinese comma is 3 bytes long, striped two of them cause the output looks weird.

It is also a bug hard to detect, If a careless translater lost the end space in translation.

-- 
Jiang Xin
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 10 in “i18n: Not add stripped contents for translation”
  1. i18n: Not add stripped contents for translationJiang Xin, Mar 5, 2012
  2. Junio C HamanoMar 5, 2012
  3. Jiang XinMar 5, 2012
  4. Junio C HamanoMar 5, 2012
  5. Jens LehmannMar 5, 2012
  6. Junio C HamanoMar 5, 2012
  7. Jiang XinMar 6, 2012
  8. Junio C HamanoMar 6, 2012
  9. Jiang XinMar 6, 2012
  10. Jiang XinMar 6, 2012

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.