Bug 363750 - KWin uses "para" instead of "p" on some QLabel's
Summary: KWin uses "para" instead of "p" on some QLabel's
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: 5
Assignee: KWin default assignee
URL: https://phabricator.kde.org/D3227
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-31 16:21 UTC by Frederik Schwarzer
Modified: 2016-11-22 19:55 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.9
mgraesslin: X11+
mgraesslin: ReviewRequest+


Attachments
Screen shot showing the issue (21.42 KB, image/png)
2016-05-31 16:22 UTC, Frederik Schwarzer
Details
Untranslated (35.97 KB, image/png)
2016-06-01 06:25 UTC, Martin Flöser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frederik Schwarzer 2016-05-31 16:21:12 UTC
On the attached image you can see that there are spaces missing in the message shown in the dialog.

The sources say this:
    QString question = i18nc("@info", "<b>Application \"%1\" is not responding</b>", appname);
    question += isLocal
        ? xi18nc("@info", "<para>You tried to close window \"%1\" from application \"%2\" (Process ID: %3) but the application is not responding.</para>",
[...]

So it seems the <para> tags are ignored.

Reproducible: Always
Comment 1 Frederik Schwarzer 2016-05-31 16:22:24 UTC
Created attachment 99287 [details]
Screen shot showing the issue
Comment 2 Martin Flöser 2016-06-01 06:25:43 UTC
Created attachment 99296 [details]
Untranslated

This works fine in the untranslated version. So this is either a problem with the translations or with the translation infrastructure. I'm not familiar with the translation architecture to properly investigate.
Comment 3 Thomas Lübking 2016-06-01 07:38:33 UTC
stray "<", the <b> isn't closed either.
Comment 4 Frederik Schwarzer 2016-06-02 09:07:12 UTC
@Thomas: could you clarify your assumption further?

My findings:
- In the German translation, I can see no fault. The tag structure is identical to the one in the original string.
    https://github.com/fschwarzer/l10n-kf5-de/blob/master/messages/kde-workspace/kwin.po#L565
    I tried using that exact file yesterday but problem persists.
- Indeed, when switching to US language, that dialog looks good.
    (although switching languages is broken in KDE in general, leading to a mixed-language system)
- Strangely, when I write a small example app just showing a window with a "<b>foo</><para>bar</para>" string,
     that string is broken regardless of the locale setting.
Comment 5 Thomas Lübking 2016-06-02 09:39:06 UTC
Re-assignment by pure odds ;-)

(In reply to Frederik Schwarzer from comment #4)

> https://github.com/fschwarzer/l10n-kf5-de/blob/master/messages/kde-workspace/
> kwin.po#L565
>     I tried using that exact file yesterday but problem persists.

Brekaing commit is  9aea91166bc9c5cd9d2e7f521e0ab1b4daf64493

"para" isn't part of the limited QLabel subset,  but is apparently fixed on some compile-time optimization.


> - Strangely, when I write a small example app just showing a window with a
> "<b>foo</><para>bar</para>" string,
>      that string is broken regardless of the locale setting.
That's not strange, that's invalid html ;-)
Comment 6 Frederik Schwarzer 2016-06-02 13:38:00 UTC
(In reply to Thomas Lübking from comment #5)
> (In reply to Frederik Schwarzer from comment #4)

> > https://github.com/fschwarzer/l10n-kf5-de/blob/master/messages/kde-workspace/
> > kwin.po#L565
> >     I tried using that exact file yesterday but problem persists.
> 
> Brekaing commit is  9aea91166bc9c5cd9d2e7f521e0ab1b4daf64493
> 
> "para" isn't part of the limited QLabel subset,  but is apparently fixed on
> some compile-time optimization.

Ths string in question is used in a KMessageBox. Does that use QLabels internally?
My minimal example indeed uses QLabel and with <p> it works. After rewriting it to use KMessageBox::warningContinueCancel() it also works with <p> but not with <para>.


> > - Strangely, when I write a small example app just showing a window with a
> > "<b>foo</><para>bar</para>" string,
> >      that string is broken regardless of the locale setting.
> That's not strange, that's invalid html ;-)

Yeah, I know. I was reaching for the "edit" button right after posting but it wasn't there. Of course I used </b> in my code. :)
Comment 7 Thomas Lübking 2016-06-02 13:44:53 UTC
(In reply to Frederik Schwarzer from comment #6)

> Ths string in question is used in a KMessageBox. Does that use QLabels
> internally?

Actually, things boil down to QTextDocument everywhere (and yes: messagebox = dialog + labels + buttonbox) - the only interesting thing here is the graceful handling of compiled strings.
Comment 8 Martin Flöser 2016-11-02 13:09:01 UTC
Possible patch at https://phabricator.kde.org/D3227
Comment 9 Martin Flöser 2016-11-03 07:58:20 UTC
Git commit 7681e312c5805f2f3a96d2d8afe990c9b5781bd8 by Martin Gräßlin.
Committed on 03/11/2016 at 07:58.
Pushed by graesslin into branch 'master'.

[helpers/killer] Use <p> instead of <para>

Summary:
para works fine for English, but seems to break in translations.
FIXED-IN: 5.9

Test Plan: Renders correctly in English. Translations not tested.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3227

M  +4    -4    helpers/killer/killer.cpp

http://commits.kde.org/kwin/7681e312c5805f2f3a96d2d8afe990c9b5781bd8
Comment 10 Lasse Liehu 2016-11-21 23:18:41 UTC
While updating translations I was intrigued why a change from <para> to <p> was made and found this bug. <para> is part of KI18n's XML tags and using it like this is correct. The root problem seems to have been German translation of ki18n. ki18n allows localizers to customize the way these semantic tags are formatted. On https://github.com/fschwarzer/l10n-kf5-de/blob/master/messages/frameworks/ki18n5.po#L352 one can see that <p>%1</p> has been incorrectly translated as <b>%1</b>.
Comment 11 Frederik Schwarzer 2016-11-22 17:44:23 UTC
Thank you Lasse for the hint.
Although I do not have time to look into the inner workings of ki18n to see if that atually fixes the issue as well, I will fix that translation error tonight.
Comment 12 Frederik Schwarzer 2016-11-22 19:55:41 UTC
SVN commit 1475453 by schwarzer:

Fix tags in translation.


 M  +5 -5      ki18n5.po  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1475453