Re: "_New" vs. N_("New") vs. N_("_New")
- From: Miguel de Icaza <miguel nuclecu unam mx>
- To: itp andrew cmu edu
- CC: gnome-list gnome org
- Subject: Re: "_New" vs. N_("New") vs. N_("_New")
- Date: Mon, 9 Nov 1998 18:31:25 -0600
> - "_<string>"
> - N_("<string>")
> - N_("_<string>")
You use _("string") to invoke a translation on "string" to the current
locale, ie, for example, you would use:
printf (_("Type in your name:"));
_(x) is a subroutine call, it usually means gettext(x).
You use N_("string"), in a context where you cant invoke a subroutine,
for example, in an array initialization:
char *names [] = { N_("One"), N_("Two") };
This will just mark the strings for translation (ie, it allows the
gettext programs extract the strings into a .po file that can be
translated). You still have to call _(x) on the string to actually
get the text translated, like this:
printf ("%s", _(names [0]));
On menus constructed with gnome-app-helper, you can use an underscore
in front of a letter to get an accelerator, so you usually do:
N_("_File")
This will mark "F" as the hotkey (you can press Alt-F and get the
action associated with this menu entry). And it will mark the string
"_File" for translation.
Miguel.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]