Bug 438470 - Color Palette Docker loads nothing by default on non-English locales
Summary: Color Palette Docker loads nothing by default on non-English locales
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: 4.4.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Tiar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-11 13:58 UTC by Tyson Tan
Modified: 2021-06-30 01:50 UTC (History)
1 user (show)

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


Attachments
Krita Layers Docker default Background Layer name string has no translation (37.34 KB, image/png)
2021-06-30 01:47 UTC, Tyson Tan
Details
Krita Layers Docker root name not translated (39.25 KB, image/png)
2021-06-30 01:50 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-06-11 13:58:53 UTC
Currently Krita's Color Palette Docker loads nothing by default. All buttons are grayed out. A user must first load, or create a palette using another "+" button hidden in the bottom of the dropdown menu to make the docker usable.

This UX design is very confusing for first time users. And thus the local community reported it to me. I don't use palette docker myself, but after testing it, I agree with their opinion.

There was a similar bug 330893, but that's before the Color Palette being rewritten.

I think we should load a palette by default, or even just an empty palette, so that the docker's buttons are clickable from the beginning.
Comment 1 Tyson Tan 2021-06-11 14:15:58 UTC
More tests have been done, it seems that when the locale is set to "American English", Krita loads a default palette. 

But for some reason, it wouldn't load under non-English locale.
Comment 2 Tyson Tan 2021-06-11 14:20:50 UTC
I found that some of the preinstalled palettes have translations. Maybe Krita tries to load the palette with the name "Default", but in the localized versions the names are localized, so Krita was unable to recognize it. 

For example, the default palette for Chinese is "默认" and for Japanese "デフォールト".
Comment 3 Tyson Tan 2021-06-11 14:27:47 UTC
I think the same issue could also happen to other default resources once Krita 5.0 introduces fully translated resource names. We might need keep an eye out for this kind of situation.
Comment 4 Tiar 2021-06-25 13:33:15 UTC
Can you please confirm that in Layer -> Split -> Split Layer, there is a selected palette and it's the "Default" palette? 

It seems like fortunately someone thought about translation in that one place so I can fix it before Krita 5. by using `i18n("Default")` since it's available in

plugins/extensions/layersplit/dlg_layersplit.cpp:55:    QString paletteName = cfg.readEntry<QString>("layersplit/paletteName", i18n("Default"));

For others, I'll need to check but are the resource names translated? Like brush presets? I know that tags are translated.
Comment 5 Tyson Tan 2021-06-25 14:21:48 UTC
Hi Tiar,

In Split Layer dialogue, the "Default" palette is selected by default, and its name has been translated. 

However, for some reason only "Default" and "Gradient" in the palette list have translated names. I have already translated all the names in krita.pot (/krita/data/palettes/).

None of the resource names have been translated. Not even the tags. I recognized some strings in krita._desktop.pot looks like they are supposed to be tags, but they aren't used in the app. There aren't any other resource strings available for translate -- brushes, patterns, none.
Comment 6 Tiar 2021-06-25 18:49:27 UTC
@Tyson, currently the way to get translated tags is to make sure that when the database is created, the Krita's language matches the language you want your tags in. Can you please confirm on your system that that's the case? And possibly, but not necessarily, for the resources too?

PS. If I copy and paste some of the translatable strings from other parts of the code, does it break the string freeze, or can I do it safely?
Comment 7 Tiar 2021-06-25 21:25:59 UTC
Git commit c75e336c15b4855c38f7a67ebdab67ba5d56926d by Agata Cacko.
Committed on 25/06/2021 at 21:25.
Pushed by tymond into branch 'master'.

Find default tag for popup palette

Before this commit, the code would use an old method
to get the tag it wanted, and it wouldn't have a way
to get the default tag (My Favourities) for non-English
systems. Because user strings cannot be changed for now,
this commit includes a hack that tries to find first tag
with star in in, assuming it's the Favourities tag.

M  +25   -7    libs/ui/kis_favorite_resource_manager.cpp

https://invent.kde.org/graphics/krita/commit/c75e336c15b4855c38f7a67ebdab67ba5d56926d
Comment 8 Tyson Tan 2021-06-26 02:02:42 UTC
Thank you Tiar.

I can confirm the tags are translated when 5.0 starts from a clean installation. However, they do not become translated when upgrading from 4.4.5 to 5.0.

The only resource names that have translatable strings are:
- Palette (default, gradient)
- Gradient (FG to BG, FG to Transparent)
Those names have been existed and translated at least since 3 years ago. However, for some reason, only the ones in () are currently used.

No other resource name has a translatable strings. I thought Krita 5.0 would allow us to have translated brushes and such. Wasn't it the case?
Comment 9 Tiar 2021-06-28 22:46:07 UTC
Note about the recent commit if anyone is confused: it was added as "related" (CCBUG) to this bug report because while it's in a different component and about a tag, not a resource, it seems like code-wise it was caused by the same thing (forgetting about translation of the name). I added a hack, true fix would change the strings...

@Tyson I just learned that apparently *tooltips* are supposed to hold translated resources names. I would need to talk about it more with Halla. However, she's on vacations...

I will look into the mystery of why only some resources have translated names.

---

Is that a regression (aka does it not happen in Krita 4.4.5)?
Comment 10 Tiar 2021-06-29 12:47:25 UTC
Git commit c018c6c3127b7adfb8f0e738f3c957f19ba0dfd2 by Agata Cacko.
Committed on 29/06/2021 at 12:47.
Pushed by tymond into branch 'master'.

Fix palette name being translated

Before this commit, palette name was translated, which meant
the default palette wasn't found.
Translations of the resource names should be stored in
`tooltip` instead.
This commit removes translation from the resource name,
but the tooltip is still translated, as it should be.
(Tested with, I believe, Japanese language).

M  +2    -1    libs/pigment/resources/KoColorSet.cpp

https://invent.kde.org/graphics/krita/commit/c018c6c3127b7adfb8f0e738f3c957f19ba0dfd2
Comment 11 Tiar 2021-06-29 12:47:30 UTC
Git commit 72b1ba46fa118bec6979dfbca4d8e3e525f091fa by Agata Cacko.
Committed on 29/06/2021 at 12:47.
Pushed by tymond into branch 'master'.

Fix finding default palette in layersplit

Before this commit, Layersplit would try to find the palette
with a translated name "Default".
In krita 5, we don't have translated names, so it wouldn't be
able to find it.
This commit changes it so it looks for the untranslated name.

M  +1    -1    plugins/extensions/layersplit/dlg_layersplit.cpp

https://invent.kde.org/graphics/krita/commit/72b1ba46fa118bec6979dfbca4d8e3e525f091fa
Comment 12 Tiar 2021-06-29 12:47:34 UTC
Git commit 788a8a3d9ff8b222771e6e4967bd44029839a79e by Agata Cacko.
Committed on 29/06/2021 at 12:47.
Pushed by tymond into branch 'master'.

Use correct context for translated resource names

Before this commit, CacheDb wouldn't use any context,
which meant that translated resource names wouldn't be used
(because the translated names had a context).
This commit provides that context so a lot more resource
names are translated.

Note: I can't say for sure if the context is correct for
all resources. If you find a resource that should have been
translated in the database but isn't, please reopen the
bug report.

M  +2    -1    libs/resources/KisResourceCacheDb.cpp

https://invent.kde.org/graphics/krita/commit/788a8a3d9ff8b222771e6e4967bd44029839a79e
Comment 13 Tiar 2021-06-29 12:47:42 UTC
Git commit 9c685a3f40205f0637c1e13d2fe88fab01c4eefa by Agata Cacko.
Committed on 29/06/2021 at 12:47.
Pushed by tymond into branch 'master'.

Remove unnecessary hack in Favourite Resource Manager

Before this commit, Favourite Resource Manager tried to find
"My Favourites" tag in the tag model by looking for the star
symbol. This is unnecessary because earlier in the code
it tries to find the correct tag by url.
Urls are not translatable and cannot be changed, so it should be
enough to just look for the url, no matter the language.

M  +0    -15   libs/ui/kis_favorite_resource_manager.cpp

https://invent.kde.org/graphics/krita/commit/9c685a3f40205f0637c1e13d2fe88fab01c4eefa
Comment 14 Tiar 2021-06-29 12:47:50 UTC
Git commit 5074a4327a8222e448a31282f75a6722689fe6fd by Agata Cacko.
Committed on 29/06/2021 at 12:47.
Pushed by tymond into branch 'master'.

Add translated name to the tooltip

Before this commit, there was no way to see the translated
resource name, because the Qt::DisplayRole shows the name,
instead of the 'tooltip' (translated name).
This commit adds the translated name to the tooltip
(only if the translated name is different from the
main name).

M  +7    -1    libs/resourcewidgets/KisIconToolTip.cpp

https://invent.kde.org/graphics/krita/commit/5074a4327a8222e448a31282f75a6722689fe6fd
Comment 15 Tiar 2021-06-29 13:09:50 UTC
Hi @Tyson,
the current state of affairs:

1) The resource name shown as the name is non-translated.

2) The translated resource name is shown on the tooltip.
(Note that (1) and (2) are consistent with the design document: 
"We currently translate brush presets and brush tips and other Gimp-based resources. We will stop doing this, because it makes it very difficult to support tutorials. However, we will show the translations as tooltips."
I am thinking that maybe it should show the translated names, but that decision needs to be made by Halla).

3) Hence, the Default palette is found, because it looks for the palette by name, which is not translated.

4) Tags are translatable and translated to Polish, at least. Seem to be working fine. (They have "url" which is not translated and "name" which is translated and shown to the user).

5) To see my fixes, you need to recreate the database, because the old is wrong (for example there are translated names for palette etc.).

6) More resource has translated resource names than before (because I added proper context when pulling the string from the po file). For example, all palettes are translated now, it's just to see the translation, you need to hover over the palette in the palette chooser...

7) To get resources and tags in a different language, you still need to remove the old database. This bug was reported here: bug 439300 to not make too much of a mess here.

8) If you find *any* resource that you know that you translated but it's not translated in Krita, please tell me (with the resource name, the language the translation is in etc.).
Comment 16 Tyson Tan 2021-06-30 01:44:32 UTC
Hi Tiar,
I can confirm the default palette is now loading and the translated names of palettes and gradients are now showing in the tooltips. Thanks!

For the untranslated things I noticed:

Brushe presets has no translation, krita.pot don't have entries for them. I think it's very important to make them translatable. Are you still planning to have translation for them in the future?

The "Background" name string for default Background layer in Layers docker does not show translation.
Comment 17 Tyson Tan 2021-06-30 01:47:13 UTC
Created attachment 139757 [details]
Krita Layers Docker default Background Layer name string has no translation
Comment 18 Tyson Tan 2021-06-30 01:50:14 UTC
Created attachment 139758 [details]
Krita Layers Docker root name not translated

The "root"prefix of a merged layer is not translated.