Re: Non-english strings



David Necas (Yeti) wrote:
On Sun, Apr 03, 2005 at 01:59:38AM +1000, Russell Shaw wrote:

How are gtk apps translated to other languages? Does someone need
to rewrite all the gtk_label strings in a program?


See gettext: http://www.gnu.org/software/gettext/

All strings obviously have to be translated.  But equaly
obviously, this is not done by changing them in application
source code.  How would switching lanaguge run-time (by
changing locales) work then?

Yeti

I was wondering how to render non-english strings in a gtk drawing area.

From http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html#id2903641

  1.12. 

  How do I draw text ?

  To draw a piece of text, use a Pango layout and gdk_draw_layout(), using code like the following:

   layout = gtk_widget_create_pango_layout (widget, text);
   fontdesc = pango_font_description_from_string ("Luxi Mono 12");
   pango_layout_set_font_description (layout, fontdesc);
   gdk_draw_layout (..., layout);
   pango_font_description_free (fontdesc);
   g_object_unref (layout);


Do you supply the string to be rendered as:

  gtk_widget_create_pango_layout(widget, gettext("A test string\n"));

?



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