← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

Re: [Merge] lp:~nikwen/ubuntu-calendar-app/fix-standalone-month-name-i18n into lp:ubuntu-calendar-app

 

Review: Needs Fixing

I've just double-checked this again, and I can confirm that the qsTr() call is not required. i18n.tr() (gettext) already takes care of the format string, it is not necessary to process it again with qsTr().

This can easily be tested with a simple QML app that includes the following string:

i18n.tr("%1 %2").arg(Qt.locale().standaloneMonthName(10, Locale.LongFormat)).arg("2011")

Diff comments:

> === modified file 'DayView.qml'
> --- DayView.qml	2015-11-23 07:15:20 +0000
> +++ DayView.qml	2015-12-03 21:28:26 +0000
> @@ -57,7 +57,9 @@
>              id:monthYear
>              objectName:"monthYearLabel"
>              fontSize: "x-large"
> -            text: currentDay.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
> +            // TRANSLATORS: This string is used in the header of the month, week and day views.
> +            // %1 is going to be replaced by the month name, %2 by the year.
> +            text: qsTr(i18n.tr("%1 %2")).arg(Qt.locale().standaloneMonthName(currentDay.getMonth(), Locale.LongFormat)).arg(currentDay.getFullYear())

qsTr() is not needed here

>              font.capitalization: Font.Capitalize
>          }
>      }
> 
> === modified file 'MonthView.qml'
> --- MonthView.qml	2015-11-23 07:15:20 +0000
> +++ MonthView.qml	2015-12-03 21:28:26 +0000
> @@ -55,10 +55,9 @@
>          contents: Label {
>              objectName:"monthYearLabel"
>              fontSize: "x-large"
> -            // TRANSLATORS: this is a time formatting string,
> -            // see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
> -            // It's used in the header of the month and week views
> -            text: currentMonth.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
> +            // TRANSLATORS: This string is used in the header of the month, week and day views.
> +            // %1 is going to be replaced by the month name, %2 by the year.
> +            text: qsTr(i18n.tr("%1 %2")).arg(Qt.locale().standaloneMonthName(currentMonth.getMonth(), Locale.LongFormat)).arg(currentMonth.getFullYear())

qsTr() is not needed here

>              font.capitalization: Font.Capitalize
>          }
>      }
> 
> === modified file 'WeekView.qml'
> --- WeekView.qml	2015-10-28 02:12:50 +0000
> +++ WeekView.qml	2015-12-03 21:28:26 +0000
> @@ -61,7 +61,9 @@
>              id:monthYear
>              objectName:"monthYearLabel"
>              fontSize: "x-large"
> -            text: i18n.tr(dayStart.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy")))
> +            // TRANSLATORS: This string is used in the header of the month, week and day views.
> +            // %1 is going to be replaced by the month name, %2 by the year.
> +            text: qsTr(i18n.tr("%1 %2")).arg(Qt.locale().standaloneMonthName(dayStart.getMonth(), Locale.LongFormat)).arg(dayStart.getFullYear())

qsTr() is not needed here

>              font.capitalization: Font.Capitalize
>          }
>      }


-- 
https://code.launchpad.net/~nikwen/ubuntu-calendar-app/fix-standalone-month-name-i18n/+merge/279509
Your team Ubuntu Calendar Developers is subscribed to branch lp:ubuntu-calendar-app.


References