Bug 415541

Summary: i18n: downloadNewWhat text used in different contexts, cannot be translated correctly
Product: [Frameworks and Libraries] frameworks-knewstuff Reporter: Alexander Potashev <aspotashev>
Component: generalAssignee: Jeremy Whiting <jpwhiting>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, admin, ecuadra, kde, kdelibs-bugs, leinir, victorr2007
Priority: NOR    
Version: 5.65.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: knewstuff-5.65.0-tr.patch
plasma-desktop-5.17.80-tr.patch
Fix translations
knewstuff-5.66-tr.patch
plasma-desktop-5.17.90-tr.patch

Description Alexander Potashev 2019-12-25 01:29:57 UTC
SUMMARY
Text from variable "downloadNewWhat" is used in different contexts:
 - button text in src/qtquick/qml/Button.qml
 - dialog title in src/qtquick/qml/Dialog.qml
 - newStuffPage.title in src/qtquick/qml/DialogContent.qml

In these contexts the text should be in different capitalization modes and grammatical cases in some languages (e.g. Russian). For now the only way to make a proper translation is to use translation scripting ( https://techbase.kde.org/Localization/Concepts/Transcript ). However translation scripting is fragile, untestable and hard to get right.

The easy solution would be to have 3 different string properties: for dialog title, for button text and for dialog subtitle.

STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Victor Ryzhykh 2019-12-26 05:53:22 UTC
Created attachment 124719 [details]
knewstuff-5.65.0-tr.patch

If knewstuff is changed using this patch knewstuff-5.65.0-tr.patch,
Comment 2 Victor Ryzhykh 2019-12-26 05:54:16 UTC
Created attachment 124720 [details]
plasma-desktop-5.17.80-tr.patch

And package plasma-desktop change with this patch plasma-desktop-5.17.80-tr.patch,
then the translation starts to display correctly on all locales.
Comment 3 Victor Ryzhykh 2019-12-26 05:55:54 UTC
Created attachment 124721 [details]
Fix translations

(In reply to Victor Ryzhykh from comment #2)
> Created attachment 124720 [details]
> plasma-desktop-5.17.80-tr.patch
> 
> And package plasma-desktop change with this patch
> plasma-desktop-5.17.80-tr.patch,
> then the translation starts to display correctly on all locales.

I will attach a picture in Russian.
Comment 4 Albert Astals Cid 2020-01-15 21:36:04 UTC
Dan can you please fix this?
Comment 5 Victor Ryzhykh 2020-01-16 00:10:38 UTC
The problem continues to multiply.
Here https://phabricator.kde.org/D26665#594287
And still here https://cgit.kde.org/plasma-desktop.git/commit/?id=442c43b3ca98807a7b93c757ffbd090c892e0e44
Comment 6 Victor Ryzhykh 2020-01-16 03:45:43 UTC
> dialog title in src/qtquick/qml/Dialog.qml

It is unclear why in the window title the text to download the file.
The window title contains the text from the download button, instead of the name of the contents of the window.
I think it will be correct when the button contains the text to download, in the window title, the name of the content.
Comment 7 Dan Leinir Turthra Jensen 2020-01-16 09:24:30 UTC
(In reply to Albert Astals Cid from comment #4)
> Dan can you please fix this?

I can - except that there are multiple proposals for how to fix it. Not being a linguist, i am going to need those who have the issue to give me less conflicting guidance on this... (or even better, for those with patches to put them on phabricator - it was my understanding that bko was now refusing to accept patches?)
Comment 8 Albert Astals Cid 2020-01-16 22:08:27 UTC
> The easy solution would be to have 3 different string properties: for dialog title, for button text and for dialog subtitle.

But there is already 2 string properties, isn't there?

./src/qtquick/qml/Button.qml:59:    text: i18n("Download New %1", downloadNewWhat)

./src/qtquick/qml/Dialog.qml:55:    title: component.downloadNewWhat.length > 0 ? i18nc("The dialog title when we know which type of stuff is being requested", "Download New %1", component.downloadNewWhat) : i18nc("A placeholder title used in the dialog when there is no better title available", "Download New Stuff")

Those are two differnt strings, so i don't see any problem there.

Can you explain why the title and the subtitle being the same text is a problem?
Comment 9 Albert Astals Cid 2020-01-16 22:09:15 UTC
(In reply to Victor Ryzhykh from comment #5)
> The problem continues to multiply.
> Here https://phabricator.kde.org/D26665#594287
> And still here
> https://cgit.kde.org/plasma-desktop.git/commit/
> ?id=442c43b3ca98807a7b93c757ffbd090c892e0e44

This text means nothing to me, please be more detailed and less apocaliptic
Comment 10 Victor Ryzhykh 2020-01-16 23:57:40 UTC
No need to do part of the phrase in the knewstuff package.
Leave it only calls 
title: i18n("%1", component.downloadNewWhat)
or
title: "%1", component.downloadNewWhat
And transfer all the text to plasma packages.
NewStuff.Button {
    downloadNewWhat: i18n("Get New Global Themes...")

This will eliminate problems in other localizations.
In which not all words of the text are written in uppercase.

For example, now "Download New Global Themes...",
Which consists of two parts of the text, from different packages.
And the translation should be "Загрузить новые темы оформеления...".
This cannot be obtained if a two-part text is compiled.

In addition, the translation of the phrase "i18n ("Download New %1", component.downloadNewWhat)" 
in the package knewstuff does not work.
Comment 11 Albert Astals Cid 2020-01-17 23:36:33 UTC
(In reply to Victor Ryzhykh from comment #10)
> No need to do part of the phrase in the knewstuff package.
> Leave it only calls 
> title: i18n("%1", component.downloadNewWhat)
> or
> title: "%1", component.downloadNewWhat

You realize 
title: "%1", component.downloadNewWhat
is just not valid QML right?

> And transfer all the text to plasma packages.
> NewStuff.Button {
>     downloadNewWhat: i18n("Get New Global Themes...")
> 
> This will eliminate problems in other localizations.
> In which not all words of the text are written in uppercase.
> 
> For example, now "Download New Global Themes...",
> Which consists of two parts of the text, from different packages.
> And the translation should be "Загрузить новые темы оформеления...".
> This cannot be obtained if a two-part text is compiled.
> 
> In addition, the translation of the phrase "i18n ("Download New %1",
> component.downloadNewWhat)" 
> in the package knewstuff does not work.

The problem here is you're speaking about different things and they have different solutions.

The first issue is a translation puzzle, that's bad and should be fixed.

The second issue seems to be a as far as i understand your text a bug that makes things not show translated.

They are not linked at all one to eachother and should not be discussed in the same bugzilla issue.

Would you think it would be a good idea to close this one and then open a new issue for each of the problems, explaining in each of the issue what the problem is and just talking about one problem in each issue?
Comment 12 Victor Ryzhykh 2020-01-17 23:50:04 UTC
Created attachment 125213 [details]
knewstuff-5.66-tr.patch

I made this patch for knewstuff
Comment 13 Albert Astals Cid 2020-01-17 23:51:28 UTC
Do not post patches on bugzilla, use phabricator for patches.
Comment 14 Victor Ryzhykh 2020-01-17 23:54:39 UTC
Created attachment 125215 [details]
plasma-desktop-5.17.90-tr.patch

I also made this patch for plasma-desktop-5.17.90.
And one more small patch for plasma-workspace-5.17.90.
Now I have no errors on my plasma.
I will wait for a solution to this problem in git.
Sincerely, Victor.
Comment 15 Victor Ryzhykh 2020-01-18 00:23:54 UTC
(In reply to Albert Astals Cid from comment #13)
> Do not post patches on bugzilla, use phabricator for patches.

https://phabricator.kde.org/D26544#596301
Comment 16 Albert Astals Cid 2020-01-18 10:09:06 UTC
(In reply to Victor Ryzhykh from comment #15)
> (In reply to Albert Astals Cid from comment #13)
> > Do not post patches on bugzilla, use phabricator for patches.
> 
> https://phabricator.kde.org/D26544#596301

In case you are not joking, that's obviously not what "use phabricator for patches means".
Comment 17 Victor Ryzhykh 2020-01-18 11:36:42 UTC
Apparently I misunderstood what is being discussed here.
I was hoping that the problem I was writing about would be resolved.
Since this is not so, I will no longer distract here with my messages.
Comment 18 Albert Astals Cid 2020-01-18 12:01:15 UTC
Someone with patience please tell Victor what "use phabricator for patches" means.

Meanwhile Dan did you understand the two different set of problems he brings up?
Comment 19 Eloy Cuadra 2020-01-20 12:41:06 UTC
It is also worth noting that the word "new" is invariable in gender (and in number) in English, but this is not the case for other languages. For example, in many languages (Spanish, Catalan, French, Italian, etc.), the translation of "new" can be masculine or feminine gender (i. e., suitable for only one of the genders, but not for both).

As far as number is concerned, I think that "download new %1" always refers to plural (themes, decorations, cursors, etc.). This should not be a problem, although I don't know if it can be for some languages.
Comment 20 David Edmundson 2020-01-21 14:17:47 UTC
With regards to those patches, I don't understand why we've gone for

-                downloadNewWhat: i18n("Plasma Styles")
+                downloadNewWhat: i18n("Get New Plasma Styles...")

as opposed to


-                downloadNewWhat: i18n("Plasma Styles")
+                text: i18n("Get New Plasma Styles...")


Then we don't need any KNS changes other than documentation and potentially deprecating downloadNewWhat. It also allows for a safe transition without breakages.
Comment 21 David Edmundson 2020-01-21 14:21:10 UTC
@victor

With regards to phabricator, what Albert was suggesting was to create a new revision on phabricator in the same workflow as developers use for other changes. 

That way we keep everything in the same workflow and we see the patch in-line and can accept or request changes appropriately and track that.
Comment 22 Albert Astals Cid 2020-01-21 17:56:20 UTC
(In reply to David Edmundson from comment #20)
> With regards to those patches, I don't understand why we've gone for
> 
> -                downloadNewWhat: i18n("Plasma Styles")
> +                downloadNewWhat: i18n("Get New Plasma Styles...")
> 
> as opposed to
> 
> 
> -                downloadNewWhat: i18n("Plasma Styles")
> +                text: i18n("Get New Plasma Styles...")
> 
> 
> Then we don't need any KNS changes other than documentation and potentially
> deprecating downloadNewWhat. It also allows for a safe transition without
> breakages.

If that works it's less disruptive and i guess better, agreed.
Comment 23 Albert Astals Cid 2020-01-21 17:56:37 UTC
(In reply to David Edmundson from comment #21)
> @victor
> 
> With regards to phabricator, what Albert was suggesting was to create a new
> revision on phabricator in the same workflow as developers use for other
> changes. 
> 
> That way we keep everything in the same workflow and we see the patch
> in-line and can accept or request changes appropriately and track that.

He unsubscribed from this bug as far as i can remember.
Comment 24 Dan Leinir Turthra Jensen 2020-01-22 09:01:56 UTC
(In reply to David Edmundson from comment #20)
> With regards to those patches, I don't understand why we've gone for
> 
> -                downloadNewWhat: i18n("Plasma Styles")
> +                downloadNewWhat: i18n("Get New Plasma Styles...")
> 
> as opposed to
> 
> 
> -                downloadNewWhat: i18n("Plasma Styles")
> +                text: i18n("Get New Plasma Styles...")
> 
> 
> Then we don't need any KNS changes other than documentation and potentially
> deprecating downloadNewWhat. It also allows for a safe transition without
> breakages.

That also is pretty much just reverting each specific button's text back to what it was before the new stuff went in, so... sure, that works! :) (it /is/ just a button, after all)
Comment 25 David Edmundson 2020-01-22 10:00:03 UTC
AFAIK old translations are still kept in the .pot files if the English translations are removed, so reverting potentially won't cause much additional translator headache.
Comment 26 Dan Leinir Turthra Jensen 2020-01-24 10:46:34 UTC
Right, just did the diff thing - https://phabricator.kde.org/D26892 - which should work for what seems to be what is desired here
Comment 27 Dan Leinir Turthra Jensen 2020-01-28 09:58:49 UTC
Git commit ec387280ad9d157786e97b440c8bf91d66ca83a1 by Dan Leinir Turthra Jensen.
Committed on 28/01/2020 at 09:58.
Pushed by leinir into branch 'Plasma/5.18'.

Switch to the old-style button text for the KNSQuick buttons

Summary:
This fixes a series of localization issues as reported in
https://bugs.kde.org/show_bug.cgi?id=415541 based on the
minimum-impact method (hopefully these strings should even
still be in the pot files...)

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: aacid, yurchor, davidedmundson, kde-i18n-doc, gikari, plasma-devel

Tags: #plasma

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

M  +1    -1    kcms/colors/package/contents/ui/main.qml
M  +1    -1    kcms/cursortheme/package/contents/ui/main.qml
M  +1    -1    kcms/desktoptheme/package/contents/ui/main.qml
M  +1    -1    kcms/icons/package/contents/ui/main.qml
M  +1    -1    kcms/ksplash/package/contents/ui/main.qml
M  +1    -1    kcms/lookandfeel/package/contents/ui/main.qml

https://commits.kde.org/plasma-desktop/ec387280ad9d157786e97b440c8bf91d66ca83a1
Comment 28 Victor Ryzhykh 2020-01-30 02:06:19 UTC
(In reply to Dan Leinir Turthra Jensen from comment #27)
> Git commit ec387280ad9d157786e97b440c8bf91d66ca83a1 by Dan Leinir Turthra
> Jensen.
> Committed on 28/01/2020 at 09:58.
> Pushed by leinir into branch 'Plasma/5.18'.
> 
> Switch to the old-style button text for the KNSQuick buttons
> 
> Summary:
> This fixes a series of localization issues as reported in
> https://bugs.kde.org/show_bug.cgi?id=415541 based on the
> minimum-impact method (hopefully these strings should even
> still be in the pot files...)
> 
> Reviewers: #plasma, davidedmundson
> 
> Reviewed By: #plasma, davidedmundson
> 
> Subscribers: aacid, yurchor, davidedmundson, kde-i18n-doc, gikari,
> plasma-devel
> 
> Tags: #plasma
> 
> Differential Revision: https://phabricator.kde.org/D26892
> 
> M  +1    -1    kcms/colors/package/contents/ui/main.qml
> M  +1    -1    kcms/cursortheme/package/contents/ui/main.qml
> M  +1    -1    kcms/desktoptheme/package/contents/ui/main.qml
> M  +1    -1    kcms/icons/package/contents/ui/main.qml
> M  +1    -1    kcms/ksplash/package/contents/ui/main.qml
> M  +1    -1    kcms/lookandfeel/package/contents/ui/main.qml
> 
> https://commits.kde.org/plasma-desktop/
> ec387280ad9d157786e97b440c8bf91d66ca83a1

Эта проблема также оставалась здесь.
https://cgit.kde.org/plasma-workspace.git/tree/wallpapers/image/imagepackage/contents/ui/config.qml

                NewStuff.Button {
                    Layout.alignment: Qt.AlignRight
                    configFile: "wallpaper.knsrc"
                    downloadNewWhat: i18n("Wallpapers")
                    viewMode: NewStuff.Page.ViewMode.Preview
                    onChangedEntriesChanged: imageWallpaper.newStuffFinished();

        }
        NewStuff.Button {
            Layout.alignment: Qt.AlignRight
            configFile: "wallpaper.knsrc"
            downloadNewWhat: i18n("Wallpapers")
            viewMode: NewStuff.Page.ViewMode.Preview
            onChangedEntriesChanged: imageWallpaper.newStuffFinished();
        }
Comment 29 Victor Ryzhykh 2020-01-30 02:08:24 UTC
Sorry for the previous post.
It is without translation.
This problem also remained here.
https://cgit.kde.org/plasma-workspace.git/tree/wallpapers/image/imagepackage/contents/ui/config.qml

                NewStuff.Button {
                    Layout.alignment: Qt.AlignRight
                    configFile: "wallpaper.knsrc"
                    downloadNewWhat: i18n("Wallpapers")
                    viewMode: NewStuff.Page.ViewMode.Preview
                    onChangedEntriesChanged: imageWallpaper.newStuffFinished();

        }
        NewStuff.Button {
            Layout.alignment: Qt.AlignRight
            configFile: "wallpaper.knsrc"
            downloadNewWhat: i18n("Wallpapers")
            viewMode: NewStuff.Page.ViewMode.Preview
            onChangedEntriesChanged: imageWallpaper.newStuffFinished();
        }