> > […]
>
> If that is the way the Clock app does it, then it’s wrong. The zeroleft
> function is not i18n friendly, and there’s a much shorter solution:
>
> Label {
> id: timeLabel
> text: new Date(0, 0, 0, index).toLocaleTimeString(Qt.locale(), "HH:mm")
> }
And even better, the format string should be localized, with a comment for translators:
> > […] toLocaleTimeStr ing(Qt. locale( ), "HH:mm")
>
> If that is the way the Clock app does it, then it’s wrong. The zeroleft
> function is not i18n friendly, and there’s a much shorter solution:
>
> Label {
> id: timeLabel
> text: new Date(0, 0, 0, index).
> }
And even better, the format string should be localized, with a comment for translators:
Label { qt-project. org/doc/ qt-5.0/ qtqml/qml- qtquick2- date.html# details for valid expressions toLocaleTimeStr ing(Qt. locale( ), i18n.tr("HH:mm"))
id: timeLabel
// TRANSLATORS: this is a time formatting string, see http://
text: new Date(0, 0, 0, index).
}