RSS/Atom feed Twitter
Site is read-only, email is disabled

I18N in Python plugin

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

I18N in Python plugin Ofnuts 07 May 19:34
  I18N in Python plugin Ragnar Brynjúlfsson 30 May 19:40
   I18N in Python plugin Ragnar Brynjúlfsson 01 Jun 22:22
    I18N in Python plugin Ragnar Brynjúlfsson 04 Jun 11:36
Ofnuts
2013-05-07 19:34:25 UTC (over 11 years ago)

I18N in Python plugin

What is the right/best/officially blessed way to handle I18N in Python plugins?

Or asked differently, what can I do in my code so that someone can make the plugin usable in other languages without having to update the code?

Ragnar Brynjúlfsson
2013-05-30 19:40:08 UTC (over 11 years ago)

I18N in Python plugin

I was just going to ask the same question. I've started implementing this in my Gimp Book plug-in, following this http://wiki.maemo.org/Internationalize_a_Python_application guide, but haven't got it working yet, and have no idea what I'm doing wrong.

What would be the correct way to go about translating a Python plug-in?

Where do the .mo files, and how can I make sure my plug-in finds them?

Cheers,

Ragnar

Ragnar Brynjúlfsson
2013-06-01 22:22:12 UTC (over 11 years ago)

I18N in Python plugin

I found this readme, that might help. http://developer.gimp.org/README.i18n

This is of interest for plug-in development

"

Third-party plug-ins (plug-ins that are not distributed with GIMP) can't have their messages in the gimp-std-plugins textdomain. We have therefore provided a mechanism that allows plug-ins to install their own message catalogs and tell GIMP to bind to that textdomain. This is necessary so that GIMP can correctly translate the menu paths the plug-in registers. Basically the plug-in has to call gimp_plugin_domain_add() or gimp_domain_plugin_add_with_path() before it registers any functions. Have a look at the script-fu plug-in to see how this is done in detail. "

Ragnar

On Thu, May 30, 2013 at 9:40 PM, Ragnar Brynjlfsson wrote:

I was just going to ask the same question. I've started implementing this in my Gimp Book plug-in, following this http://wiki.maemo.org/Internationalize_a_Python_application guide, but haven't got it working yet, and have no idea what I'm doing wrong.

What would be the correct way to go about translating a Python plug-in?

Where do the .mo files, and how can I make sure my plug-in finds them?

Cheers,

Ragnar

Ragnar Brynjúlfsson
2013-06-04 11:36:04 UTC (over 11 years ago)

I18N in Python plugin

I've added i18n/gettext support to my plug-in over the weekend. I don't know if it's completely correct, but it does work. :)

You can get it from here http://ragnarb.com/toolbox/gimp-book/ and have a look at the code.

The translation code is at the beginning of booy.py, and each string to be translated is simply wrapped like this _("string here"). There is a ReadMe file in the locale folder, plus some helper shell scripts for setting up the different languages, you can look at.

Hope that helps.

Cheers,

Ragnar