标题: 问个土问题,Return _("XXX");的下划线做何用途 [打印本页] 作者: MaxWu 时间: 2009-05-11 14:55 标题: 问个土问题,Return _("XXX");的下划线做何用途 return _("it is based on your username"
Re: _() Macro
From: Trevor Johnson <trevor jpj net>
To: Andreas Sliwka <goff nef wh uni-dortmund de>
cc: gtk-app-devel-list redhat com
Subject: Re: _() Macro
Date: Sat, 20 Nov 1999 07:26:36 -0500 (EST)
> Hi,
Hi, Andreas.
> I jsut read the gnome documentation and found in gnomeabout.html the
> macro _() (it wasnt defined but used). The corresponding text says:
> >note that the descriptive text is surrounded by the _(). This will have
> > the text translated to the the user's language at runtime.
>
> How is this done? Where do I find more information/documentation about this?
If you have GNU gettext, you can read about it on one of the gettext info
pages:
Many packages use `_' (a simple underline) as a keyword, and write
`_("Translatable string"' instead of `gettext ("Translatable
string"'. Further, the coding rule, from GNU standards, wanting that
there is a space between the keyword and the opening parenthesis is
relaxed, in practice, for this particular usage. So, the textual
overhead per translatable string is reduced to only three characters:
the underline and the two parentheses. However, even if GNU `gettext'
uses this convention internally, it does not offer it officially. The
real, genuine keyword is truly `gettext' indeed. It is fairly easy for
those wanting to use `_' instead of `gettext' to declare: