Re: How use GNOME/GTK+ Internacionalization stuff ?



Fernando Alencar Maróstica <famarost unimep br> writes:

[...]

> I want internacionalization this code:

Are you using autoconf/automake? Then you lack a

 #include <config.h>

If not, you probably need to

  #define HAVE_GETTEXT 1

or something like that. Some header somewhere looks at whether
HAVE_GETTEXT is defined and either defines _(s) to "gettext(s)" or
just "" if it is not defined. Or something like that. :-)

> #include <glib.h>
> #include <gnome.h>
> #include <glade/glade.h>
> #include <strings.h>

[...]

>   bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
>   textdomain (PACKAGE);

Also, if this is GTK+ 2.x, you also need

  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

Else gettext will deliver the strings in the encoding of the locale
instead of in the UTF-8 encoding which GTK+ needs.


[...]

> 
> /*
>  * INTERNACIONALIZATION HERE !!
>  */
> 
>   cmdAdd = glade_xml_get_widget (gui, "lblOptionPosition");
>   gtk_label_set_text (GTK_LABEL(cmdAdd), _("Field Positions"));
>   
>   cmdClose = glade_xml_get_widget (gui, "lblFieldPosition");
>   gtk_label_set_text (GTK_LABEL(cmdClose), _("Options Position"));

Also, as a last point: if you want to test the translations, the .po
files need to be converted to .mo files and installed somewhere
gettext can find them (i.e. PACKAGE_LOCALE_DIR). But you probably
already knew this.


PS: It is not a big problem, but a more appropriate list would
probably be gnome-devel-list.

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/



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