Re: Non-english strings
- From: Russell Shaw <rjshaw netspace net au>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Non-english strings
- Date: Mon, 04 Apr 2005 15:58:23 +1000
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?
I was wondering how to render non-english strings in a gtk drawing area.
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);
Do you supply the string to be rendered as:
gtk_widget_create_pango_layout(widget, gettext("A test string\n"));
] [Thread Prev