Re: Help with an i18n bug



Hi,

"Kevin Vandersloot" <kfv101@psu.edu> writes:

> Thanks for the reply. That doesn't seem to work though. The strings are
> defined like such:
> 
> const gchar *default_table[] = {
>     "X", N_("X window system"), "gnome-mdi.png",
>     "bash", N_("bourne again shell"), "gnome-term.png",
>     "gnome-session", N_("Gnome-Session"), "gnome-logo-icon-transparent.png",
>     "galeon-bin", N_("Galeon Web Browser"), "galeon.png",
>     "sawfish", N_("Sawfish Window Manager"), "sawfish.png",
>     NULL
> };
> 
> and then I tried within the program
> prettyname = g_strdup (gettext (table[i + 1]));
> 
> Later on in the program the string that gets displayed just g_strdup's this
> prettyname string. Do I have to put the _( ) or gettext ( ) here also? ie.

uhh, why are you duplicating your strings like crazy? Anyway, it should
be sufficient to call gettext() when displaying the string, e.g. as in
 
        gtk_label_set_text (gettext (table[index]));

If you translate the string earlier, it should work too, but I suggest you
translate your strings when you display them to avoid confusion and to make
it possible to switch languages on the fly without too much hassle.

> display_string = g_strdup (_(prettyname));

this is definitely wrong, since it not only calls gettext, but also marks
(prettyname) for translation. xgettext should notify that this is not a 
valid string and most probably everything will work just fine, but it is
still wrong.


Salut, Sven




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]