After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 762286 - Make templaterc file translatable
Make templaterc file translatable
Status: RESOLVED OBSOLETE
Product: GIMP
Classification: Other
Component: Internationalisation
2.8.16
Other All
: Normal enhancement
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2016-02-18 18:04 UTC by scootergrisen
Modified: 2018-05-24 16:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make template names translatable. (16.74 KB, patch)
2016-06-13 13:05 UTC, Jehan
none Details | Review

Description scootergrisen 2016-02-18 18:04:20 UTC
I would like to be able to translate the templates file "templaterc" into my language so the GIMP translation is more complete.
Comment 1 Jehan 2016-02-25 21:42:12 UTC
Technically it won't be too hard (I actually made a small quick'n dirty patch locally which does this).

I see one major issue though: we provide a bunch of default templates, but in the end, they are user-managed, and user-made. If the user was to make a new template with a name which somehow matched a translatable string, it would be translated!

Ex: you would write your own "Toilet paper" template and (if your GIMP was in French), you'd see "Papier toilette", even though you wrote in English on purpose! Worse, you could somehow match any other of our texts. Like you could not call a template "Palette" without it ending up translated.
That would create a weird "bug-like" behavior where users would write something and something else appears.

I think that's a problem, unless we special case our default templates, but then that becomes more annoying.
Comment 2 Ask Hjorth Larsen 2016-03-08 15:32:42 UTC
If the framework allows, one could mark all the translations in the templaterc with a particular msgctxt.  That would immediately disambiguate them from all translations except those that came from the template in the first place.
Comment 3 Jehan 2016-06-13 13:05:16 UTC
Created attachment 329694 [details] [review]
Make template names translatable.

I was looking into this again. The first time you run GIMP, since no user templaterc can be found, the system templaterc is used, but then it is saved afterwards in the user's config dir (you can notice for instance that you can delete or edit default templates. They are not protected resources).

So there are 2 cases from there:

- a template is called "Toilet Paper" and the user never edited it. We should consider that this is still a string owned by GIMP, hence try and translate it through gettext. For instance, a French-localized GIMP should read "Papier toilette" even though internally "Toilet Paper" is saved as the template name.

- a template has been edited by the user, whether it be the name or any other of the template's properties (size, color profile, whatever). When this happens, the ownership of the object should be given to the user, and the translated name should become the internally saved name, which means that we should never try to translate it anymore. So for instance even if the user decided to name the template back to "Toilet Paper" (for whatever reason, even if the rest of the GUI is French, not our business!) through the GUI, we should not try and translate (the user would go crazy: one writes "Toilet Paper", then Enter, and bam! it reads "Papier Toilette" => would look like a bug).

To implement this, I added a "user-owned" property to an object. By default it is FALSE. gimp_object_get_name() always returns the name which is set internally, without localization (so nothing ends up broken, especially for any part of our code like object serialization which may break with localized names).
gimp_object_get_user_name() returns the display name, which can be localized if the object belongs to GIMP, or returned as-is when the object belongs to the user.
gimp_object_set_user_name() sets the name and gives ownership to the user.
gimp_object_set_user_owned() gives ownership to the user.

Right now, I use this only on templates, but we will now be able to use this for any GimpObject, and localize more resources.

Patch attached for review.
Then we will be missing only the extraction of translatable strings from rc files into po files. Maybe we should have a po-etc/ directory for these?

And of course, with this, we can extend the translation to other rc files (controller names: "Main keyboard" and so should be translated…).
Comment 4 Michael Schumacher 2017-06-01 08:23:24 UTC
Do we consider this for 2.10? Would be annoying to not have it just because it didn't get discussed :)
Comment 5 Jehan 2017-06-01 10:47:59 UTC
Obviously I am all for. With the attached patch, template names are already localized. All we will miss now is the code to extract our template names into the po files for translators to have something to do (I can work on this if I am told the first patch is OK to go).

And we will be able to apply this to any other kind of GimpObject later with this new infrastructure.
Comment 6 Jehan 2018-02-28 01:00:20 UTC
Adding 2.10 milestone. For info, I rebased and improved this code 2 months ago. But let's not add this for 2.10 anyway. As soon as we release, I'll post the updated patches so that I can include this for a 2.10.x.
Comment 7 GNOME Infrastructure Team 2018-05-24 16:10:43 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/852.