Code review comment for lp:~pkunal-parmar/ubuntu-calendar-app/TimeLineView

Revision history for this message
Olivier Tilloy (osomon) wrote :

> > […]
>
> 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:

  Label {
    id: timeLabel
    // TRANSLATORS: this is a time formatting string, see http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-date.html#details for valid expressions
    text: new Date(0, 0, 0, index).toLocaleTimeString(Qt.locale(), i18n.tr("HH:mm"))
  }

« Back to merge proposal