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

Re: [PATCH] WIP: begin to translate git with gettext

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 18, 2010, 08:11 UTC
Message-ID
<AANLkTikNzz5T4oJR1MQjdWjs-4zmWfXrPaBOHNfAi-1S@mail.gmail.com>
In-Reply-To
<4BF24467.7000204@drmicha.warpmail.net>

On Tue, May 18, 2010 at 07:40, Michael J Gruber <git@drmicha.warpmail.net> wrote:

Show 5 quoted lines
> I have no experience whatsover with gettext, but it looks quite
> dangerous to me to have printf format specifiers as part of the
> localized text. It means that our programs can crash depending on the
> LANG setting at run time if localisers mess up. We'll never catch this
> unless we run all tests in all languages!

I don't have much experience with gettext either (except through Launchpad), maybe it has some internal facilities to avoid errors in these cases.

You can test if the translated messages contain the same format specifiers as the originals, and in any case much larger projects than Git manage dozens of translations with gettext while avoiding disaster.

Show 7 quoted lines
> Also, the basic structure of the output should probably be independent
> of the language, preferring consistent structure across languages over
> linguistically consistent structure  within a language.
>
> That means we'll have to do a lot of strcat's (the _() things are not
> compile time constants, are they?) rather than those mechanical
> replacements above. Are you prepared to do that?

Generally you don't to strcat's since you don't want to enforce word order, doing so will make the messages sound like Yoda in some of the target languages.

That does mean re-arranging some code if it's to be done properly.
Show 10 quoted lines
>>               break;
>>       default:
>> -             die("bug: unhandled diff status %c", status);
>> +             die(_("bug: unhandled diff status %c"), status);
>>       }
>>       if (extra.len) {
>> -             color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "%s", extra.buf);
>> +             color_fprintf(s->fp, color(WT_STATUS_HEADER, s), _("%s"), extra.buf);
>
> Seriously?

No, as Jeff said it's just a proof of concept. That patch as-is doesn't reflect good translation practices, it just bootstraps gettext.

Which is very useful by the way, thanks Jeff.
Previous: Michael J GruberNext: Jeff Epler
Message 5 of 9 in “WIP: begin to translate git with gettext”
  1. WIP: begin to translate git with gettextJeff Epler, May 17, 2010
  2. Robert BuckMay 17, 2010
  3. Ævar Arnfjörð BjarmasonMay 18, 2010
  4. Michael J GruberMay 18, 2010
  5. Ævar Arnfjörð BjarmasonMay 18, 2010
  6. Jeff EplerMay 18, 2010
  7. Ævar Arnfjörð BjarmasonMay 18, 2010
  8. Ævar Arnfjörð BjarmasonMay 20, 2010
  9. Dévai TamásMay 21, 2010

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.