PDA

View Full Version : how to set a non english language in gtk label ?



brijith
February 16th, 2009, 05:54 AM
Hai friends,

I have developed a Application using python + pygtk. In it all the labels and messages are in English. now I want to change it in to a non English language. How can I do that in a easy manner. Since I have lots of labels it is difficult to change each of then manually.


Please Help Me

Thanks

cph05a
February 24th, 2009, 05:00 PM
I've never used python, but here's how you can switch to different character sets in c: http://www.gtk.org/api/2.6/glib/glib-Character-Set-Conversion.html

cabalas
February 24th, 2009, 10:43 PM
You want to look into gettext, it allows you to translate the strings in applications and display the appropriate language. Unfortunately after a quick google I couldn't find any good links.

Edit: Perhaps I'm just going blind here is a link to look into http://docs.python.org/library/gettext.html

kknd
February 25th, 2009, 02:39 PM
The language for the stock icons matchs your locale. If you system is in Portuguese, and you have the translations instaled, it will automatically show the stock icons in Portuguese.

For your text, you can use gettext to do this.
You can switch languages too by forcing a locale change.

#include <locale.h>

char *setlocale(int category, const char *locale);