Assuming you only use stock buttons and you have installed support for the locale that you want to display, under Linux you can run this:
import gtk
dialog = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "Hello world")
response = dialog.run()
dialog.destroy()
Starting with:
LC_ALL='sv_SE.utf8' python test.py
should display, "Nej" and "Ja" buttons (Swedish). And:
LC_ALL='en_US.utf8' python test.py
should display, "No" and "Yes" buttons.
You can also set this explicit in code:
import gtk
import locale
locale.setlocale(locale.LC_ALL, 'sv_SE.utf8')
dialog = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "Hello world")
response = dialog.run()
dialog.destroy()
Prerequisites
Install the appropriate language pack, e.g. in this case Swedish (sv):
sudo apt-get install language-pack-sv language-pack-gnome-sv