[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] help a decrepit c programmer
- Subject: [ale] help a decrepit c programmer
- From: warlord at MIT.EDU (Derek Atkins)
- Date: Mon, 27 Dec 2010 15:24:46 -0500
- In-reply-to: <[email protected]> (Tim Watts's message of "Fri, 24 Dec 2010 19:24:56 -0500")
- References: <[email protected]>
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