[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Do not use gettextize and i18n round 2 Re: I18n: The gettext proposal

From: Nicolás Lichtmaier <nick_at_reloco.com.ar>
Date: 2004-03-30 20:13:57 CEST

Ben Collins-Sussman wrote:

>>I think my biggest concern for i18n adoption is that we will no longer be able
>>to use constant char *'s for our error strings (the big help structs). A lot
>>of our help code and error strings rely upon that, so I don't know how we're
>>going to refactor that.
>>
>>
>
>I don't understand... can you elaborate? In Nicolas' email, he
>explained how a number of code changes would be required to work with
>the xgettext scanner. Is this another one to add to that list?
>
>

Yes. This is the issue:

You can't add a function call anywhere in the code. You can't add a
function call in a static initializer, like:

char *global_greetings[] = { _("Hello"), _("Hi"), NULL };

This won't compile. The solution is to have a macro which does nothing:
"N_":

#define N_(x) (x)

char *global_greetings[] = { N_("Hello"), N_("Hi"), NULL };

This will be caught by xgettext and it will be put in the .pot file, but
global_greeting will still have the English messages. We fix that by
calling "gettext" on the string:

for(p=global_greetings;p;p++)
        printf(gettext(global_greeting));

We use "gettext" here so as not to trigger xgettext.

That's it!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 30 20:18:38 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.