[pygtk] Internationalization my App

saeed saeed.gnu at gmail.com
Wed Jun 17 17:08:03 WST 2009


No need to manually create a HBox or Pixbuf. That's too more simple.
For Buttons:

  button_ok = gtk.Button('ورود')
  button_ok.set_image(gtk.image_new_from_stock(gtk.STOCK_OK,
gtk.ICON_SIZE_BUTTON))

And for Menu Items:

  item_ok = gtk.ImageMenuItem('ورود')
  item_ok.set_image(gtk.image_new_from_stock(gtk.STOCK_OK, gtk.ICON_SIZE_MENU))

But you are not forced to translate default auto widgets(only for translation).
For example if you will use "تائید" for "OK", or "انصراف" for
"Cancel", or anything
that exists in GTK translation itself, you can surrender them(all
default stocks as them are)
to PyGTK itself, by defining the locale persian(fa_IR.UTF-8) or use the active
locale of system itself, and detect the active locale for translating only
extra custom widgets (for example text "Export" or "صدور" with icon
"gtk.STOCK_CONVERT")
I can describe more, if you ask it in a persian forum!

On 6/17/09, Walter Leibbrandt <walter at translate.org.za> wrote:
> mahdieh saeed wrote:
>> every thing is OK but I want to use *built in* stock as icon .For
>> example use gtk.STOCK_OK but with *custom label* or *translation label
>> to Persian language*.
>>
>>
>> Is there any way to do this?
> The only way I've found to do this is to create a container-type button,
> add a gtk.HBox containing an image (the stock icon) and a label.
>
> HTH,
>
> --
> Walter Leibbrandt                  Software Developer
> Recent blogs:
> * Conquering the CellRendererWidget
> http://www.translate.org.za/blogs/walter/en/content/conquering-cellrendererwidget
>
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>


More information about the pygtk mailing list