[ale] help a decrepit c programmer
Derek Atkins
warlord at MIT.EDU
Mon Dec 27 15:24:46 EST 2010
Tim Watts <tim at cliftonfarm.org> writes:
> What does this C expression do:
>
> _("Authors")
>
> I can't find any macro or function definition for it. I haven't done any
> serious c coding since the heydays of OS/2 (did it ever have a heyday?).
> My guess is it's some kind of unicode operator? A little help from the
> pros, s'il vous plait...
It's a localization shortcut used with GetText. It does two things:
1) It marks the string "Authors" as a translatable string, and
2) It immediately called 'gettext()' on the string in-place so the
result is the translated version.
There are other macros you can use. For example, you can use:
N_("Translate me");
This will mark the string as translatable but still use the untranlated
version immediately.
Then later you can do:
const char* foo = "Translate me";
printf("%s\n", _(foo));
-derek
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the Ale
mailing list