From kde-kimageshop Wed Jun 30 09:49:34 2021 From: Alvin Wong Date: Wed, 30 Jun 2021 09:49:34 +0000 To: kde-kimageshop Subject: Re: HTML `& quot; ` entity in Qt designer UI file causes translation to not be used Message-Id: <20781576-c8fe-4df1-12de-0e477deac55e () alvinhc ! com> X-MARC-Message: https://marc.info/?l=kde-kimageshop&m=162504663716709 I made a merge request on this: https://invent.kde.org/sdk/kde-dev-scripts/-/merge_requests/15 Alvin Wong 於 24/6/2021 22:19 寫道: > Hi, > > Some of the formatting have been mixed up. Please check > https://invent.kde.org/-/snippets/1730 for a clearer version of the > message. > > Best Regards, > > Alvin Wong > > Alvin Wong 於 24/6/2021 22:06 寫道: >> Hi, >> >> When I was checking the translations for Krita, I noticed some UI >> items not using the translation even though they are available and >> translated in the PO files. On further investigation I found out it >> is due to the HTML """ entity in the strings. >> >> For example, the string in >> `libs/ui/forms/wdgperformancesettings.ui:552`[1] contains >> `&quot;`, which is output as `"` inside a string literal by >> `uic`. The full line in the generated header file is as follows: >> >> chkTransformToolForceLodMode->setToolTip(tr2i18n("

The >> transform tool preview will always use instant preview, even if >> instant preview is disabled in the "View" >> menu

", nullptr)); >> >> In the PO file [2] however, the extracted string looks like this: >> >>     #. i18n: ectx: property (toolTip), widget (QCheckBox, >> chkTransformToolForceLodMode) >>     #: libs/ui/forms/wdgperformancesettings.ui:552 >>     #, kde-format >>     msgid "" >>     "

The transform tool preview will always use >> instant " >>     "preview, even if instant preview is disabled in the \"View\" >> menu

>     "body>" >>     msgstr "" >> "

強制變形工具使用即時預覽,無視「顯示」選單中停用即時預" >> >>     "覽的設定

" >> >> Notice that the double-escaped `&quot;` gets transformed into `"` >> (double quote) instead of `"`, making the string not match and >> causing the translation to not be used. Indeed, if I replace the >> `&quot;` in the UI file with just `"` (double quote), the >> translated string shows up properly. >> >> We use the Qt designer tool and I believe that the entity >> `&quot;` is generated by said tool. Shall we be manually >> replacing these entities in our UI files, or is it a bug in the POT >> extraction process that needs fixing? >> >> Best Regards, >> >> Alvin Wong >> >> [1]: >> https://invent.kde.org/graphics/krita/-/blob/eb72dd1b857e1daf7316175dec5d7738b00aef23/libs/ui/forms/wdgperformancesettings.ui#L552 >> [2]: >> https://websvn.kde.org/*checkout*/trunk/l10n-kf5/zh_TW/messages/krita/krita.po?revision=1603060&content-type=text%2Fplain >>