Bug 451807

Summary: QML: falsey values are considered missing arguments
Product: [Frameworks and Libraries] frameworks-ki18n Reporter: Janet Blackquill <uhhadd>
Component: generalAssignee: Chusslove Illich <caslav.ilic>
Status: RESOLVED FIXED    
Severity: normal CC: kdelibs-bugs-null, me, nate
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Janet Blackquill 2022-03-22 22:37:59 UTC
Falsey values are considered missing arguments; e.g. `0` doesn't count as an argument due to 0 being a falsey value. This results in something like the following not working: i18n("i have %1 things", 0).
Comment 1 ratijas 2022-06-30 00:08:34 UTC
I tried to reproduce it with the following code, but I didn't spot any problems with the status quo

    import QtQuick.Controls 2.15
    import org.kde.kirigami 2.20 as Kirigami

    Kirigami.Page {
        title: "BUG 451807"
        contentItem: Kirigami.FormLayout {
            TextField {
                text: i18n("i have %1 things", 0)
            }
            TextField {
                text: i18n("i have %1 things", 1)
            }
        }
    }
Comment 2 Albert Astals Cid 2022-06-30 22:33:22 UTC
Git commit d72b03c088e4ba0103872d2dc4fd4a33d75c5062 by Albert Astals Cid.
Committed on 30/06/2022 at 22:26.
Pushed by aacid into branch 'master'.

Accept null strings from QML

M  +2    -0    autotests/ki18ndeclarativetest.cpp
M  +3    -0    autotests/test.qml
M  +10   -10   src/i18n/klocalizedcontext.cpp

https://invent.kde.org/frameworks/ki18n/commit/d72b03c088e4ba0103872d2dc4fd4a33d75c5062