Bug 442156 - Preset choosers are not using the translated names
Summary: Preset choosers are not using the translated names
Status: CONFIRMED
Alias: None
Product: krita
Classification: Applications
Component: Translation (show other bugs)
Version: 5.0.0-beta1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on: 439760
Blocks:
  Show dependency treegraph
 
Reported: 2021-09-08 04:20 UTC by Tyson Tan
Modified: 2022-09-14 08:29 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot of untranslated tooltip (208.42 KB, image/png)
2022-07-05 11:28 UTC, Halla Rempt
Details
screenshot of krita preset hover translation (53.66 KB, image/png)
2022-07-05 11:39 UTC, Tyson Tan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2021-09-08 04:20:47 UTC
Krita 5.0 now supports translation for Preset names. However, the names in all Preset choosers are still using the English names:

- Brush preset Right click names
- Gradient names on top of the chooser
- Pattern names on top of the chooser
- Popup Palette preset tooltips
- Predefined brush tip list side panel top text
- Manage Resource dialogue
- Bundles don't have names to translate in Manage Resource Library

For now, the only way to display the translated names is to hover the cursor to their thumbnails and wait a while for the tooltips to pop up. This isn't very intuitive, and very slow. It doesn't work on Popup Palette either, which only shows the English names.

There are two exceptions:
FG to BG gradient
FG to transparent gradient
are using their translated names for some reason.

I wish this issue can be improved so that our default presets are much easier to understand to local communities.
Comment 1 Tyson Tan 2021-09-08 06:50:50 UTC
And Workspace Chooser's presets list too.
Comment 2 Halla Rempt 2021-09-08 08:54:52 UTC
Well, that is actually intentional... In https://phabricator.kde.org/T379, we discuss this. The actual resource names are not translated so tutorials can referto the original names. We've been discussing this with windragon on irc, but there's no real solution here yet.
Comment 3 Tyson Tan 2021-09-08 11:55:55 UTC
My opinion is quite the opposite. My logic goes like this:

1) If someone uses a localized version, chances are they can't read English very well. In that case, our base presets are not of much use without a separated guide, which is rather counter productive.

2) Not all people needs to follow a tutorial. But EVERY USER needs to read from the UI. Crippling an essential part of the UI for something may or may not be useful is also rather counter productive.

3) If people needs to follow a tutorial, they'd have used one in their native language. Those who use localized Krita most likely won' be able to use an English tutorial anyway. If the tutorial was translated, it's only natural for the translator to translate the names for them -- like what I did in Krita's documentation.

4) They can learn the original names from the tooltip WHEN THEY NEEDED IT.

5) But everyone must be able to understand the presets ALL THE TIME.

Therefore, I recommend to make the translated preset names the default in Krita's UI.
Comment 4 Halla Rempt 2022-07-05 09:46:16 UTC
Hm, trying to do this now, but for some reason the translations (I'm testing with es) aren't picked up.
Comment 5 Tyson Tan 2022-07-05 11:18:34 UTC
The translated names are displayed in a popup when you  are hovering over on a preset. There are two lines - the English line is always on top. Maybe the English name line is not i18n?

This arrangement works okay for Krita's default icon list view, but not so much with the detailed list view.
Comment 6 Halla Rempt 2022-07-05 11:28:20 UTC
Created attachment 150409 [details]
screenshot of untranslated tooltip

Here, when testing the spanish translation, the tooltip doesn't have a translation. I've checked that the po file provides the translation. There are other problems: the extracti18n.pl script does some sanitizing in the hope that it can create a nice name from the filename for resource types that don't have a name field:

sub parseFromFilename($$) {
  # function that prettifies filenames
  # it extracts the filename from the full path, cuts off the extension and replaces '_  with ' '
  my $name = $_[0];
  my $extension = $_[1];
  chomp($name);
  my @path = split(/\//, $name);
  $name = $path[$#path];
  $name =~ s/_/ /g;
  if( $extension ne "" ) {
    $name =~ s/\.${extension}$//g;
  }
  return $name;
}

We don't do this in most cases in Krita itself anymore, because that gave problems. But... That means that the po files have, for instance Cross04 for name, while Krita has Cross04.pat.

#. i18n: Display name of resource, see context: [path-to-resources]/[resource-type]/[resource-filename]
#, kde-format
msgctxt "./krita/data/patterns/Cross04.pat"
msgid "Cross04"
msgstr "Cruz04"

But even if I fix that, or filter the name before looking up the translation, a debug line that prints i18n("Cross04") doesn't print a translated string, and I don't know why that is.
Comment 7 Tyson Tan 2022-07-05 11:39:19 UTC
Created attachment 150410 [details]
screenshot of krita preset hover translation

It works for me with Simplified Chinese translation here. It has been like this for us since Krita 5.0, which is quite acceptable, so I have completely forgotten about this bug...

What I think might fix your situation though: uninstall Krita, delete all its presets from:
/home/username/.local/share/krita/
Then reinstall Krita.

If that fixed it for you, then Krita is loading preset names from either:
1) the current preset files
or
2) the database

My theory is that if you have been upgrading from an old version, and you have never cleared out the old assets, it could cause such issue.

Since I need to test Krita all the time, I routinely clear out my assets and configurations when weird things happens
Comment 8 Alvin Wong 2022-07-05 11:48:59 UTC
The translated tooltip names are written to the database on first creation (there should be an open bug that tracks this), perhaps this is why you are not seeing the translated names?

> We don't do this in most cases in Krita itself anymore, because that gave problems. But... That means that the po files have, for instance Cross04 for name, while Krita has Cross04.pat.

When was this changed? Are you sure this is breaking anything? I believe when these names first become translated I personally verified that every one of them are translated.

> But even if I fix that, or filter the name before looking up the translation, a debug line that prints i18n("Cross04") doesn't print a translated string, and I don't know why that is.

You're missing the message context: i18nc("./krita/data/patterns/Cross04.pat", "Cross04")
Comment 9 Alvin Wong 2022-07-05 12:11:56 UTC
bug 439300 Translation of tags and resources only happen when creating the database - it was marked as fixed but the fix only handled translation of tag names, the issue still exists for resource names.
Comment 10 Alvin Wong 2022-07-05 12:16:38 UTC
This is where the translation of the resource names happens last time I checked: https://invent.kde.org/graphics/krita/-/blob/c65b9e93e57651cd119ef759fee2e8ecfb0c3c43/libs/resources/KisResourceCacheDb.cpp#L1000
Comment 11 Halla Rempt 2022-07-05 12:24:12 UTC
I'm beginning to see how to properly fix this.
Comment 12 Bug Janitor Service 2022-07-05 13:14:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1503
Comment 13 Halla Rempt 2022-09-14 08:29:36 UTC
I don't see a working solution that provides both keeping the translations up to date and keep the query fast, so I'm not going to work on this anymore.