HTML `& quot; ` entity in Qt designer UI file causes translation to not be used

Alvin Wong alvin at
Thu Jun 24 15:06:26 BST 2021


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 `"`, 
which is output as `"` inside a string literal by `uic`. The full 
line in the generated header file is as follows:

transform tool preview will always use instant preview, even if instant 
preview is disabled in the "View" menu</p></body></html>", 

In the PO file [2] however, the extracted string looks like this:

     #. i18n: ectx: property (toolTip), widget (QCheckBox, 
     #: libs/ui/forms/wdgperformancesettings.ui:552
     #, kde-format
     msgid ""
     "<html><head/><body><p>The transform tool preview will always use 
instant "
     "preview, even if instant preview is disabled in the \"View\" 
     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 

Best Regards,

Alvin Wong


More information about the kde-i18n-doc mailing list