Some of ui are left untranslated on windows though they are translated in translation resource files (3.0 alpha git f38b47e)
Closed, ResolvedPublic

Description

In 3.0 alpha git f38b47e on windows, some of ui won't be translated with translation resource (.mo) files where the parts of ui are already translated. This issue happens in every language.



Untranslated parts are in various places, especially in...

  • menu
  • right click popup in layer docker

I use the following translation files


Restricted Application added a subscriber: woltherav. · View Herald TranscriptApr 21 2016, 9:58 AM
tokiedian updated the task description. (Show Details)Apr 21 2016, 10:04 AM
tokiedian updated the task description. (Show Details)

Hi Michael,

I'm a bit puzzled by this bug... I've tried to follow what happens for the import animation frames action and that string actually never is printed if I add debug info to QString quietlyTranslate(const QString &s) { -- and I'm guess that it definitely should be.

rempt triaged this task as High priority.Apr 25 2016, 10:34 AM

This is getting weirder and weirder, with debug output in quietly translate:

krita(7027)/(default) unknown: "Save Incremental &Version" translates to "増分バージョンを保存(&V)"
krita(7027)/(default) unknown: "Save Incremental Version" translates to "Save Incremental Version"

Where the mo file has:

#. i18n: context: Action (save_incremental_version), Actions (File), ActionCollection (Menu)
#. +> trunk5
#: krita/kritamenu.action:138
msgctxt "action"
msgid "Save Incremental &Version"
msgstr "増分バージョンを保存(&V)"

#. i18n: context: Action (save_incremental_version), Actions (File), ActionCollection (Menu)
#. +> trunk5
#: krita/kritamenu.action:140
msgctxt "action"
msgid "Save Incremental Version"
msgstr "増分バージョンを保存"

That is very bizarre. I'll look into it.

rempt added a comment.Apr 25 2016, 7:49 PM

Thanks! I spent a couple of hours on it today and ended up as baffled as a bathroom geyser.

abrahams added a comment.EditedApr 25 2016, 10:37 PM

Okay, I found one problem in the action manager code, which meant we were using some untranslated strings for certain menu items. Now "Save Incremental &Version" will display properly in the menu.

However this problem of failing to match the string "Save Incremental Version" without the ampersand is still baffling to me. I don't think that it's a problem with the dynamic translation i18n(s.toUtf8().constData()) in KisActionRegistry though. If I just add a debug line like this in the code, the string still fails to translate. So my guess is that the translation must be messed up for some other reason.

qDebug() << Save Incremental Version" << "translates to" << i18n("Save Incremental Version");
rempt added a comment.Apr 26 2016, 6:13 AM

Notes from the translation mailing list:

From: Nick Shaforostoff <shafff@ukr.net>
Reply-To: KDE i18n-doc <kde-i18n-doc@kde.org>
To: KDE i18n-doc <kde-i18n-doc@kde.org>
Cc: kde-i18n-doc@kde.org
Subject: Re: translation debugging problem

the first thing i would do is to change msgstr of translatable string and see if the changes are
visible to the code.

also, what is strange is that msgctxt is non-empty, while to get translation i18n is used and not
i18nc.

msgctxt "action"
msgid "Save Incremental &Version"
msgstr "増分バージョンを保存(&V)"

...

return i18n(s.toUtf8().constData());

also toLatin1() would be enough, i believe.
and even better is to pass msgid content as qbytearray or const char* everywhere

From: Albert Astals Cid <aacid@kde.org>
To: kde-i18n-doc@kde.org
Cc: Nick Shaforostoff <shafff@ukr.net>, Boudewijn Rempt <boud@valdyas.org>
Subject: Re: translation debugging problem

El dilluns, 25 d’abril de 2016, a les 22:17:32 CEST, Nick Shaforostoff va
escriure:

the first thing i would do is to change msgstr of translatable string and
see if the changes are visible to the code.

also, what is strange is that msgctxt is non-empty, while to get translation
i18n is used and not i18nc.

As Nick says your i18n call is wrong, you're not passing a context to i18n,
the one that works is probably working by change because it's somewhere else
defined too without the context.

I'll try that when I am home again.

Hi Boud: changing the call to i18nc context "action" seems to fix the problem.

I don't think the rest of Nick's recommendations are actionable. It does seem to be important to use toUtf8() instead of toLatin1(), because we use some non-ascii symbols like the degree sign in "Rotate Layer 90° to the Right." Also since we use the QDomElement XML reader, the initial data to translate will be read in as QString, not char* or qbytearray.

rempt added a comment.Apr 26 2016, 7:45 PM

Hm, I just made beta builds, and there even more is untranslated, apparently because some translations do not have a context. I'm experimenting a bit now.

fazek added a subscriber: fazek.Apr 26 2016, 7:56 PM

About the ampersand: I think the translation is using a hash table for the i18n translation. Maybe the hash code calculation drops the ampersand (perhaps together with other "whitespace" characters) for some reason. In this case the two strings has the same hash id.

rempt added a comment.Apr 26 2016, 8:00 PM

https://i.imgur.com/QA850zk.png -- even New and Open are not translated now.

rempt added a comment.Apr 26 2016, 8:01 PM

The ampersand and other characters, like the dots are part of the key -- they aren't dropped.

But what did we add that context for, in the extract script?

abrahams added a comment.EditedApr 26 2016, 8:02 PM
In T2333#31099, @rempt wrote:

Hm, I just made beta builds, and there even more is untranslated, apparently because some translations do not have a context. I'm experimenting a bit now.

Really?? My entire UI works now... now this seems bizarre.

Are you using the krita.mo from @tokiedian?

rempt added a comment.EditedApr 26 2016, 8:13 PM

Yes... And even more interestingly, after the commit that checks whether the translation translated something and if not, used the i18n without context, I do get a fully-translated Japanese Krita. Maybe I'm just going crazy, though, and should take the rest of the evening off.

abrahams added a comment.EditedApr 26 2016, 8:36 PM

I tried out the fallback patch and my Japanese UI continues to work fine.

fazek added a comment.Apr 26 2016, 8:43 PM

@rempt: from the first menu, only the "&File" and "&Save" keys has no msgctxt in the .po file. And on your picture these are the only translated ones.
Good night!

I confirmed this problem has been solved in Japanese and German on 3.0 Beta git 25ecbaf.

rempt closed this task as Resolved.Apr 27 2016, 2:57 PM
rempt claimed this task.
tokiedian reopened this task as Open.May 4 2016, 6:56 AM

I found other untranslated areas.


(New Layer, Add Existing Layer and Remove Layer)

(Select Color Window)

I cannot found their translations on any translation files used by krita, so I think developers forgot add translation tags to them. Please check whether they are translatable.

For the untranslated animation strings, it looks like there are a number of untranslated user-facing strings in plugins\dockers\animation\, under addAction() setToolTip() and maybe others.

fazek added a comment.May 5 2016, 4:55 PM

After a quick search, there are still some setToolTip() calls without i18n():

plugins/dockers/animation/timeline_frames_view.cpp: m_d->zoomDragButton->setToolTip("Zoom Timeline...

plugins/dockers/historydocker/KisUndoView.cpp: s->setToolTip("The amount of... (+2 others),

plugins/extensions/gmic/kis_gmic_widget.cpp: updateBtn->setToolTip("Fetching...

And there are also in libs/ui/widgets/kis_advanced_color_space_selector.cc with some strange html codes.

fazek added a comment.May 5 2016, 5:12 PM

also found some QLabels without translations, please check:

libs/ui/recorder/kis_recorded_filter_action_editor.cc: m_gridLayout->addWidget(new QLabel("No con...

libs/ui/recorder/kis_recorded_paint_action_editor.cc: m_gridLayout->addWidget(new QLabel("No configu...

plugins/dockers/historydocker/KisUndoView.cpp: QLabel *l = new QLabel("Start merging time"); (+2 others),

plugins/tools/basictools/kis_tool_measure.cc: optionLayout->addWidget(new QLabel("deg", this), 1, 2);

There are addItem() calls without i18n:

plugins/flake/pathshapes/spiral/SpiralShapeConfigWidget.cpp: widget.clockWise->addItem("ClockWise"); (+1 other)

plugins/tools/karbonplugins/filtereffects/CompositeEffectConfigWidget.cpp: m_operation->addItem("Over"); (+5 others).

rempt added a comment.May 6 2016, 7:39 AM

Wow, some of those are _ancient_.

rempt closed this task as Resolved.May 14 2016, 7:01 AM

This is fixed on Windows by placing all the translation files in the right place and letting Qt know where they are. For the Qt translations to work, the system language needs to be set correctly, too.