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

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> 232 + // FIXME: how to represent
> 233 + text: index+":00"
>
> This should be localized, probably something like this (not sure it would work
> for all possible regional settings, but should be better than nothing):
>
> text: i18n.tr("%1:00").arg(index)
>
> What exactly was the FIXME about?

As David suggested, I tried to use code from Clock source code. I am using following code now. Does it looks ok ?

My implementation is only hourToLocaleString() this function. Other are copied from Clock.

    function numberToLocaleString(num) {
        return Number(num).toLocaleString(Qt.locale(), "f", 0)
    }

    function zeroleft ( number, zeroCount ) {
        var resstring = numberToLocaleString(number.toString());
        var numchart = zeroCount;
        var numberlength = resstring.length;
        for (var i = numberlength; i < numchart; i++) {
            resstring = numberToLocaleString("0") + resstring;
        }
        return resstring;
    }

    function hourToLocaleString(hour) {
        return zeroleft(hour,2)+":"+ zeroleft(0,2);
    }

« Back to merge proposal