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

Re: [PATCH] i18n: move the trailing space out of translatable strings

From
Keshav Kini <keshav.kini@gmail.com>
Date
Dec 8, 2013, 03:56 UTC
Message-ID
<87vbz0f11t.fsf@gmail.com>
In-Reply-To
<CACsJy8CBC3qk7NQPR3UWhUdA+o+hXPLPXV+8fz4ctCSV1J2hcA@mail.gmail.com>

The following message is a courtesy copy of an article that has been posted to gmane.comp.version-control.git as well.

Duy Nguyen <pclouds@gmail.com> writes:
Show 10 quoted lines
> On Sun, Dec 8, 2013 at 9:11 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>> I could fix vi.po alone, but it'd be better to avoid similar mistakes
>> for all translations by moving the trailing space out of all
>> translatable strings (*). This is inline with how we handle newlines
>> (e.g. *printf_ln wrappers) but it's not widespread enough to make new
>> *printf_space wrappers.
>
> And I just realized spaces are more common in languages using latin
> alphabet but are not a rule. CJK languages do not have/need spaces so
> this might be a wrong move..

There are already other issues as well. The strings also seem to be assuming certain word orders. For example:

> -					on_what = _("HEAD detached at ");
> +					on_what = _("HEAD detached at");

Both versions of this assume that the location at which HEAD was detached should come at the end of the sentence, whereas in rightward-headed languages such as Japanese it would be more natural to put the location at the middle or beginning of the sentence (while it is possible to rewrite the text a bit to force the location to come at the end).

I think the best practice is to just have one long string per "message" the program is supposed to display, and only display that string with %s substituted for data, rather than printing that string and then printing the data, or printing the data and then printing the string, or whatever. With printf() in C, the %s can even be reordered wrt to the calling order with a special syntax, "%m$", if necessary, as I just learned from `man 3 printf`...

-Keshav
Previous: Duy NguyenNext: Junio C Hamano
Message 3 of 4 in “i18n: move the trailing space out of translatable strings”
  1. i18n: move the trailing space out of translatable stringsNguyễn Thái Ngọc Duy, Dec 8, 2013
  2. Duy NguyenDec 8, 2013
  3. Keshav KiniDec 8, 2013
  4. Junio C HamanoDec 9, 2013

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.