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

Proposed by Niklas Wenzel
Status: Needs review
Proposed branch: lp://qastaging/~nikwen/ubuntu-calendar-app/fix-standalone-month-name-i18n
Merge into: lp://qastaging/ubuntu-calendar-app
Diff against target: 330 lines (+61/-67)
4 files modified
DayView.qml (+3/-5)
MonthView.qml (+3/-5)
WeekView.qml (+9/-10)
po/com.ubuntu.calendar.pot (+46/-47)
To merge this branch: bzr merge lp://qastaging/~nikwen/ubuntu-calendar-app/fix-standalone-month-name-i18n
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Nekhelesh Ramananthan Needs Fixing
David Planella Needs Fixing
Kunal Parmar Pending
Review via email: mp+279509@code.qastaging.launchpad.net

Commit message

Fix bad month translations for some languages, e.g. Polish

Description of the change

Fix bad month translations for some languages, e.g. Polish

See the related bug report for more information on why this change is necessary. ;)

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
736. By Niklas Wenzel

Remove id attribute that I used during testing

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

Thanks :), this changes seems fine to me, but need to test is once and then approve it

Revision history for this message
David Planella (dpm) wrote :

Why do you need to call qsTr()? IIRC, it should work with i18n.tr() only already.

qsTr(i18n.tr("%1 %2")).arg(Qt.locale().standaloneMonthName(currentMonth.getMonth(), Locale.LongFormat)).arg(currentMonth.getFullYear())

review: Needs Information
Revision history for this message
David Planella (dpm) wrote :

Sorry, to be more specific:

- Qt.locale() should choose the right locale for you already for the standaloneMonthName, without needing qsTr()
- Does currentMonth.getFullYear() not need to be localized as well?

review: Needs Information
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Thank you, Kunal and David, for looking into this.

@David, to clear this up a bit:

qsTr() is responsible only for the format string here. i18n.tr() delivers the translated format string while qsTr() in combination with the arg() calls then goes ahead and replaces %1 and %2 with the arguments, i.e. the month and the year. That said, qsTr() does not do any translation job and is only needed for the format string story. I couldn't find anything in the i18n documentation to replace the qsTr() and arg() calls here. [1]
Regarding the year: Qt.locale() does not provide any way to localize the year. [2] Hence, I don't think we need to do anything, especially considering that we are talking about a number.

[1] https://developer.ubuntu.com/api/apps/qml/sdk-15.04.1/Ubuntu.Components.i18n/
[2] http://doc.qt.io/qt-5/qml-qtqml-locale.html

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Any update on this? Kunal, have you given it a try yet?

Revision history for this message
David Planella (dpm) wrote :

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")

review: Needs Fixing
737. By Niklas Wenzel

Remove qsTr() calls

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

So I just learned something new. Thanks, David! :)

(By the way, would it be possible to add an example for that to https://developer.ubuntu.com/api/apps/qml/sdk-15.04.1/Ubuntu.Components.i18n/ ?)

Now I just have to sort out the merge conflicts.

738. By Niklas Wenzel

Merge trunk

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Fixed the merge conflicts. Would you mind looking into it again, please? :)

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Looking at the Jenkins logs, I don't think the test failures are related to the changes here. (Please correct me if I'm wrong, though!) Any idea what was happening?

Revision history for this message
Niklas Wenzel (nikwen) wrote :

No ideas?

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

@nikwen, Hi there, we're looking to release calendar v0.5 with OTA-10. I would like to get this bug fix into trunk before that. Can we work on getting this done?

I have two questions,

1. why at all do we need i18n.tr() calls? Can we just do "%1 %2".arg().arg() which then substitutes the month and year accordingly? Or is this for RTL language support where the order may need to be changed?

2. calendar app trunk has gone through a huge code change. Please merge trunk and push again pls.

review: Needs Fixing
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Hey Nekhelesh,

I'm sorry for being a bit late.

The reason why I put the i18n.tr() calls in there is because there might be languages in which it is "2016 April" instead of "April 2016". I'm not sure about whether there are any such languages, but if we are already fixing translation issues, I'd prefer to make it as flexible as possible. Furthermore, in my opinion the i18n.tr() calls don't hurt anyone if no such languages exist.

I'll merge trunk now. :)

739. By Niklas Wenzel

Merge trunk

740. By Niklas Wenzel

Also fix bug in a new place where it has been introduced

741. By Niklas Wenzel

Readd newlines where accidently removed

742. By Niklas Wenzel

Empty commit to make LP rebuild the diff

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Finished merging. Thank you for your patience, Nekhelesh! :)

Revision history for this message
David Planella (dpm) wrote :

Thanks Niklas, and good work everyone!

On Wed, Apr 6, 2016 at 10:38 PM, Niklas Wenzel <email address hidden>
wrote:

> Finished merging. Thank you for your patience, Nekhelesh! :)
> --
>
> https://code.launchpad.net/~nikwen/ubuntu-calendar-app/fix-standalone-month-name-i18n/+merge/279509
> You are reviewing the proposed merge of
> lp:~nikwen/ubuntu-calendar-app/fix-standalone-month-name-i18n into
> lp:ubuntu-calendar-app.
>

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Nekhelesh, would you mind having a look at this again? :)

Unmerged revisions

742. By Niklas Wenzel

Empty commit to make LP rebuild the diff

741. By Niklas Wenzel

Readd newlines where accidently removed

740. By Niklas Wenzel

Also fix bug in a new place where it has been introduced

739. By Niklas Wenzel

Merge trunk

738. By Niklas Wenzel

Merge trunk

737. By Niklas Wenzel

Remove qsTr() calls

736. By Niklas Wenzel

Remove id attribute that I used during testing

735. By Niklas Wenzel

Fix bad month translations for some languages, e.g. Polish

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: