This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gettext markup of library sources


On Mon, Apr 21, 2003 at 12:33:50PM -0700, Ulrich Drepper wrote:
> Phil Edwards wrote:
> 
> > +// XXX These are only placeholders.  They let people mark up the library
> > +// sources without breaking things, and will be probably be somewhere else
> > +// once localization of the library itself is functioning.
> > +#define _(__msgid)                 (__msgid)
> > +#define __N(__msgid)               (__msgid)
> > +#define __gettext_noop(__msgid)    (__msgid)
> 
> There is no reason to define __gettext_noop.  The functionality is
> always identical to that of _N (or this __N abomination).

__N is used for a reason.  Sorry if you don't like it, but this needs
to not break the library build under Solaris (where _N exists in system
headers as I said before).

Oh, and I checked:  unfortunately, the definition of _N in those headers
is not the same one here, else we could simply use it.  It's something
for their ctype implementation.


> Only
> gettext_noop is useful since xgettext automatically recognizes this
> name.  __gettext_noop is not recognized.  Don't blindly copy and then
> change things.

Thank you for pointing that out.


> Also, using __ prefexes in macro parameters is completely unnecessary.
> Those tokens are not in the normal namespace and therefore aren't
> polluting it.

I'm uncertain how you mean that, but either way I believe you are mistaken.

If you mean, "they are macros, not types/variables/functions, therefore
the rules don't matter," the C++ standard does not make the distinction
when reserving the __* names.  If the user chooses to #define something,
it mustn't break us any more than the converse.

If you mean, "these macros are never seen by the user," this is template
code in headers, which means the macros /must/ be seen by the user.

(I think you meant the first, in which case I'll let you and Gaby argue
over it.)


> Is this really what you want?  Do you want to throw the translated
> string?  This seems wasteful.  It means every instantiation has a call
> to gettext which adds to the code size.
> 
> If there is a central place where the strings are used (in the terminate
> handler?) put the gettext call in there and use __N in the throw calls.
  
I tried that first, but they weren't being translated.  Will try again.

(Gaby will really love you for this one.  Now he has to see __N instead
of _ everywhere.  *grin*)



Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]