Re: [Gimp-developer] How to distribute translated/translatable python plugins in 2.99



Hi,

On Tue, Jul 26, 2022 at 10:50 PM Ofnuts via gimp-developer-list <
gimp-developer-list gnome org> wrote:

Thanks. Eventually made it to work.

I am planning to make tutorials for all the GIMP 3.0 API for plug-in
creation, and more generally extension creation. This will include
localization.
We are currently also in the process of reviving
https://developer.gimp.org/ (which is very outdated right now).

Since I just finished migrating my first V2 plugin to V3 I think I can
help there, with firsthand experience.  Recently retired, so plenty of
time. PM me you needs (En or FR). This will  give you more time to
finish GimpUi.ProcedureDialog which is still missing a replacement for
PF_OPTION, which is a major impairment for my migration efforts(*).


I just checked old 2.10 plug-ins. I see PF_OPTION is a Python API thingy.
Apparently it was to make combo boxes from properties?

We can already do this in the 3.0 API using int properties. A bunch of
plug-ins already use this. For instance look at the PNG plug-in:
https://gitlab.gnome.org/GNOME/gimp/-/blob/cac7ed93a0debedf1c60c2e71dc9a038b3ffb454/plug-ins/common/file-png.c#L2280-2291

Now I am still planning to improve this, I think I explain this in some
report somewhere but I can't find it right now (or maybe I forgot to write
this down). Basically the idea is to move the int_store part from GUI into
the procedure definition (the query_procedure() method) as a complement of
the int argument:
https://gitlab.gnome.org/GNOME/gimp/-/blob/cac7ed93a0debedf1c60c2e71dc9a038b3ffb454/plug-ins/common/file-png.c#L274-279

Because right now, for people using the API in scripts, we have to list the
whole values in the argument description (i.e.:
https://gitlab.gnome.org/GNOME/gimp/-/blob/cac7ed93a0debedf1c60c2e71dc9a038b3ffb454/plug-ins/file-jpeg/jpeg.c#L234-237
) but this is very annoying, both for translation, keeping it up-to-data,
but also when the values list is very long (for instance, recently I was
updating the file-raw-data plug-in and one of the int arguments is such a
list of options and it's veryyy long.

If we can move this store list into the properties, it could make
everything easier.


Some
preference for the Wiki on Gitlab, though,


The wiki on Gitlab was considered but it is a hassle to use because of
access permissions. Apparently you need to have Developer permissions to be
allowed to write on the Gitlab wiki too. It means we can't easily give
access to more people.

unless markdown can be used
for developer.gimp.org/


Yes, this is the goal. The full data has already been ported to Markdown
(and using the Hugo framework) to facilitate contributions.



That's actually one of the things I still have to review and make
decisions or changes about. Look at my little checkbox at the bottom
of this comment:
https://gitlab.gnome.org/GNOME/gimp/-/issues/8124#note_1493804
The one box still unchecked says "Menu paths" which I believe is what
you are asking about.

This is comment bait, and I won't resist...


Comment answered there too.

Jehan



(*) usage stats in my Python plugins:

       1 PF_GRADIENT
       1 PF_TEXT
       2 PF_LAYER
       2 PF_PALETTE
       3 PF_FONT
       6 PF_COLOR
      12 PF_INT
      13 PF_DIRNAME
      19 PF_TOGGLE
      30 PF_STRING
      37 PF_FLOAT
      38 PF_DRAWABLE
      48 PF_VECTORS
      52 PF_SLIDER
      82 PF_SPINNER
     109 PF_IMAGE
     153 PF_OPTION



On 26/07/2022 16:48, Jehan Pagès wrote:
Hi!

On Mon, Jul 25, 2022 at 11:38 PM Ofnuts via gimp-developer-list
<gimp-developer-list gnome org> wrote:

    What is necessary to distribute a translation-enabled python
    plugin for
    2.99?

    I assume that the plugin distribution should be self-sufficient
since
    it cannot assume that translations will be available in some general
    repository.

    What should the plugin directory look like (it seems it needs a
    "locale"
    subdirectory)?

Indeed.

    But adding and "fr.po" file there with some msgid/msgstr
    doesn't seem enough.


It must be "compiled" too. `.po` files are source for `.mo` (or
`.gmo`) files.
Also it must be in subdirectories (standard translation
organizations). So if your plug-in is called "my-plug-in", then the
.mo file for French would likely be in
locale/fr/LC_MESSAGES/my-plug-in.mo

    Are there examples available (outside of Gimp's
    source code since these use the general repo).


Anyway that's a lot of work being done right now. We can't give ETA,
but it will happen. :-)


    And do menu locations need to be translated as well?


That's actually one of the things I still have to review and make
decisions or changes about. Look at my little checkbox at the bottom
of this comment:
https://gitlab.gnome.org/GNOME/gimp/-/issues/8124#note_1493804
The one box still unchecked says "Menu paths" which I believe is what
you are asking about.

Again, it's on my TODO, but I can't give an ETA. My hope is that I can
make time to finish this one for the next dev release. We'll see.

Jehan


    --

    Ofnuts




    _______________________________________________
    gimp-developer-list mailing list
    List address: gimp-developer-list gnome org
    List membership:
    https://mail.gnome.org/mailman/listinfo/gimp-developer-list
    List archives: https://mail.gnome.org/archives/gimp-developer-list



--
ZeMarmot open animation film
http://film.zemarmot.net
Liberapay: https://liberapay.com/ZeMarmot/
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot

_______________________________________________
gimp-developer-list mailing list
List address:    gimp-developer-list gnome org
List membership:
https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list



-- 
ZeMarmot open animation film
http://film.zemarmot.net
Liberapay: https://liberapay.com/ZeMarmot/
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]