ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #02362
[Merge] lp:~penk/ubuntu-clock-app/use_replace_to_trim_am_pm_text into lp:ubuntu-clock-app
Penk Chen has proposed merging lp:~penk/ubuntu-clock-app/use_replace_to_trim_am_pm_text into lp:ubuntu-clock-app.
Requested reviews:
Ubuntu Clock Developers (ubuntu-clock-dev)
Related bugs:
Bug #1458808 in Ubuntu Clock App: "DigitalMode time is empty in Chinese locale"
https://bugs.launchpad.net/ubuntu-clock-app/+bug/1458808
For more details, see:
https://code.launchpad.net/~penk/ubuntu-clock-app/use_replace_to_trim_am_pm_text/+merge/260121
Using replace() instead of split() to trim amText/pmText, this prevents time string being cut empty in some locale (e.g. in Chinese).
English locale:
10:01 AM // time
10:01 // time.split(Qt.locale().amText)[0].trim()
10:01 // time.replace(Qt.locale().amText, "").trim()
Chinese locale:
上午 10:01 // time
// time.split(Qt.locale().amText)[0].trim()
10:01 // time.replace(Qt.locale().amText, "").trim()
--
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~penk/ubuntu-clock-app/use_replace_to_trim_am_pm_text into lp:ubuntu-clock-app.
=== modified file 'app/components/DigitalMode.qml'
--- app/components/DigitalMode.qml 2014-10-10 19:58:49 +0000
+++ app/components/DigitalMode.qml 2015-05-26 10:15:47 +0000
@@ -58,11 +58,11 @@
text: {
if (time.search(Qt.locale().amText) !== -1) {
// 12 hour format detected with the localised AM text
- return time.split(Qt.locale().amText)[0].trim()
+ return time.replace(Qt.locale().amText, "").trim()
}
else if (time.search(Qt.locale().pmText) !== -1) {
// 12 hour format detected with the localised PM text
- return time.split(Qt.locale().pmText)[0].trim()
+ return time.replace(Qt.locale().pmText, "").trim()
}
else {
// 24-hour format detected, return full time string
Follow ups