Merge lp:~aacid/ubuntu-ui-toolkit/i18n-RelativeDateTime into lp:ubuntu-ui-toolkit/staging
- i18n-RelativeDateTime
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Zsombor Egri |
Approved revision: | 1611 |
Merged at revision: | 1604 |
Proposed branch: | lp:~aacid/ubuntu-ui-toolkit/i18n-RelativeDateTime |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Prerequisite: | lp:~aacid/ubuntu-ui-toolkit/LiveTimer |
Diff against target: |
679 lines (+512/-24) 12 files modified
components.api (+1/-0) src/Ubuntu/Components/plugin/i18n.cpp (+74/-0) src/Ubuntu/Components/plugin/i18n.h (+1/-0) src/Ubuntu/Components/plugin/timeutils_p.h (+24/-0) tests/unit/tst_i18n/tst_i18n.pro (+3/-18) tests/unit/tst_i18n/tst_i18n_LocalizedApp/src/LocalizedApp.qml (+43/-1) tests/unit/tst_i18n/tst_i18n_LocalizedApp/src/tst_i18n_LocalizedApp.cpp (+5/-5) tests/unit/tst_i18n/tst_i18n_LocalizedApp/tst_i18n_LocalizedApp.pro (+17/-0) tests/unit/tst_i18n/tst_i18n_RelativeTime/po/en_US.po (+54/-0) tests/unit/tst_i18n/tst_i18n_RelativeTime/src/RelativeTime.qml (+71/-0) tests/unit/tst_i18n/tst_i18n_RelativeTime/src/tst_i18n_RelativeTime.cpp (+202/-0) tests/unit/tst_i18n/tst_i18n_RelativeTime/tst_i18n_RelativeTime.pro (+17/-0) |
To merge this branch: | bzr merge lp:~aacid/ubuntu-ui-toolkit/i18n-RelativeDateTime |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lukáš Tinkl (community) | code-review | Needs Fixing | |
PS Jenkins bot | continuous-integration | Approve | |
Zsombor Egri | Approve | ||
Review via email: mp+267788@code.launchpad.net |
Commit message
Added relative date time i18n
Description of the change
Added relative date time i18n
- 1608. By Nick Dedekind
-
i18n.relativeDa
teTime - 1609. By Nick Dedekind
-
review comments
- 1610. By Nick Dedekind
-
split relative time i18n
- 1611. By Nick Dedekind
-
split relative time i18n from localizedApp
Albert Astals Cid (aacid) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1213
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Lukáš Tinkl (lukas-kde) wrote : | # |
One small optimization comment
Preview Diff
1 | === modified file 'components.api' | |||
2 | --- components.api 2015-08-12 10:11:43 +0000 | |||
3 | +++ components.api 2015-08-12 10:11:44 +0000 | |||
4 | @@ -1405,3 +1405,4 @@ | |||
5 | 1405 | function string dctr(string domain, string context, string text) | 1405 | function string dctr(string domain, string context, string text) |
6 | 1406 | function string tag(string text) | 1406 | function string tag(string text) |
7 | 1407 | function string tag(string context, string text) | 1407 | function string tag(string context, string text) |
8 | 1408 | function string relativeDateTime(QDateTime datetime) | ||
9 | 1408 | 1409 | ||
10 | === modified file 'src/Ubuntu/Components/plugin/i18n.cpp' | |||
11 | --- src/Ubuntu/Components/plugin/i18n.cpp 2015-03-03 13:47:48 +0000 | |||
12 | +++ src/Ubuntu/Components/plugin/i18n.cpp 2015-08-12 10:11:44 +0000 | |||
13 | @@ -17,6 +17,7 @@ | |||
14 | 17 | */ | 17 | */ |
15 | 18 | 18 | ||
16 | 19 | #include "i18n.h" | 19 | #include "i18n.h" |
17 | 20 | #include "timeutils_p.h" | ||
18 | 20 | #include <QtCore/QDir> | 21 | #include <QtCore/QDir> |
19 | 21 | 22 | ||
20 | 22 | namespace C { | 23 | namespace C { |
21 | @@ -252,3 +253,76 @@ | |||
22 | 252 | Q_UNUSED(context); | 253 | Q_UNUSED(context); |
23 | 253 | return text; | 254 | return text; |
24 | 254 | } | 255 | } |
25 | 256 | /*! | ||
26 | 257 | * \qmlmethod string i18n::relativeDateTime(datetime dateTime) | ||
27 | 258 | * Translate a datetime based on proximity to current time. | ||
28 | 259 | */ | ||
29 | 260 | QString UbuntuI18n::relativeDateTime(const QDateTime& datetime) | ||
30 | 261 | { | ||
31 | 262 | QDateTime relativeTo(QDateTime::currentDateTime()); | ||
32 | 263 | const date_proximity_t prox = getDateProximity(relativeTo, datetime); | ||
33 | 264 | |||
34 | 265 | switch (prox) { | ||
35 | 266 | case DATE_PROXIMITY_NOW: | ||
36 | 267 | /* TRANSLATORS: Time based "this is happening/happened now" */ | ||
37 | 268 | return dtr("ubuntu-ui-toolkit", "Now"); | ||
38 | 269 | |||
39 | 270 | case DATE_PROXIMITY_HOUR: | ||
40 | 271 | { | ||
41 | 272 | qint64 diff = datetime.toMSecsSinceEpoch() - relativeTo.toMSecsSinceEpoch(); | ||
42 | 273 | qint64 minutes = qRound(float(diff) / 60000); | ||
43 | 274 | if (minutes < 0) { | ||
44 | 275 | return dtr("ubuntu-ui-toolkit", "%1 minute ago", "%1 minutes ago", qAbs(minutes)).arg(qAbs(minutes)); | ||
45 | 276 | } | ||
46 | 277 | return dtr("ubuntu-ui-toolkit", "%1 minute", "%1 minutes", minutes).arg(minutes); | ||
47 | 278 | } | ||
48 | 279 | |||
49 | 280 | case DATE_PROXIMITY_TODAY: | ||
50 | 281 | /* en_US example: "1:00 PM" */ | ||
51 | 282 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
52 | 283 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
53 | 284 | return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "h:mm ap"): | ||
54 | 285 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
55 | 286 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
56 | 287 | dtr("ubuntu-ui-toolkit", "HH:mm")); | ||
57 | 288 | |||
58 | 289 | case DATE_PROXIMITY_YESTERDAY: | ||
59 | 290 | /* en_US example: "Yesterday 13:00" */ | ||
60 | 291 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
61 | 292 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
62 | 293 | return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "'Yesterday\u2003'h:mm ap") : | ||
63 | 294 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
64 | 295 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
65 | 296 | dtr("ubuntu-ui-toolkit", "'Yesterday\u2003'HH:mm")); | ||
66 | 297 | |||
67 | 298 | case DATE_PROXIMITY_TOMORROW: | ||
68 | 299 | /* en_US example: "Tomorrow 1:00 PM" */ | ||
69 | 300 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
70 | 301 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
71 | 302 | return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "'Tomorrow\u2003'h:mm ap") : | ||
72 | 303 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
73 | 304 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
74 | 305 | dtr("ubuntu-ui-toolkit", "'Tomorrow\u2003'HH:mm")); | ||
75 | 306 | |||
76 | 307 | case DATE_PROXIMITY_LAST_WEEK: | ||
77 | 308 | case DATE_PROXIMITY_NEXT_WEEK: | ||
78 | 309 | /* en_US example: "Fri 1:00 PM" */ | ||
79 | 310 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
80 | 311 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
81 | 312 | return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "ddd'\u2003'h:mm ap") : | ||
82 | 313 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
83 | 314 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
84 | 315 | dtr("ubuntu-ui-toolkit", "ddd'\u2003'HH:mm")); | ||
85 | 316 | |||
86 | 317 | case DATE_PROXIMITY_FAR_BACK: | ||
87 | 318 | case DATE_PROXIMITY_FAR_FORWARD: | ||
88 | 319 | default: | ||
89 | 320 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
90 | 321 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
91 | 322 | return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "ddd d MMM'\u2003'h:mm ap") : | ||
92 | 323 | /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by | ||
93 | 324 | https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ | ||
94 | 325 | dtr("ubuntu-ui-toolkit", "ddd d MMM'\u2003'HH:mm")); | ||
95 | 326 | } | ||
96 | 327 | return datetime.toString(Qt::DefaultLocaleShortDate); | ||
97 | 328 | } | ||
98 | 255 | 329 | ||
99 | === modified file 'src/Ubuntu/Components/plugin/i18n.h' | |||
100 | --- src/Ubuntu/Components/plugin/i18n.h 2015-02-03 18:11:32 +0000 | |||
101 | +++ src/Ubuntu/Components/plugin/i18n.h 2015-08-12 10:11:44 +0000 | |||
102 | @@ -50,6 +50,7 @@ | |||
103 | 50 | Q_INVOKABLE QString dctr(const QString& domain, const QString& context, const QString& text); | 50 | Q_INVOKABLE QString dctr(const QString& domain, const QString& context, const QString& text); |
104 | 51 | Q_INVOKABLE QString tag(const QString& text); | 51 | Q_INVOKABLE QString tag(const QString& text); |
105 | 52 | Q_INVOKABLE QString tag(const QString& context, const QString& text); | 52 | Q_INVOKABLE QString tag(const QString& context, const QString& text); |
106 | 53 | Q_INVOKABLE QString relativeDateTime(const QDateTime& datetime); | ||
107 | 53 | 54 | ||
108 | 54 | // getter | 55 | // getter |
109 | 55 | QString domain() const; | 56 | QString domain() const; |
110 | 56 | 57 | ||
111 | === modified file 'src/Ubuntu/Components/plugin/timeutils_p.h' | |||
112 | --- src/Ubuntu/Components/plugin/timeutils_p.h 2015-08-12 10:11:43 +0000 | |||
113 | +++ src/Ubuntu/Components/plugin/timeutils_p.h 2015-08-12 10:11:44 +0000 | |||
114 | @@ -20,9 +20,33 @@ | |||
115 | 20 | #include "livetimer.h" | 20 | #include "livetimer.h" |
116 | 21 | 21 | ||
117 | 22 | #include <QDateTime> | 22 | #include <QDateTime> |
118 | 23 | #include <QLocale> | ||
119 | 23 | #include <QObject> | 24 | #include <QObject> |
120 | 24 | #include <QTimer> | 25 | #include <QTimer> |
121 | 25 | 26 | ||
122 | 27 | /* Check the system locale setting to see if the format is 24-hour | ||
123 | 28 | time or 12-hour time */ | ||
124 | 29 | inline bool isLocale12h(void) | ||
125 | 30 | { | ||
126 | 31 | QString strTimeFormat = QLocale::system().timeFormat(); | ||
127 | 32 | QStringList includes; includes << "AP"; includes << "ap"; | ||
128 | 33 | QStringList excludes; excludes << "H"; excludes << "HH"; | ||
129 | 34 | |||
130 | 35 | Q_FOREACH(const QString& exclude, excludes) { | ||
131 | 36 | if (strTimeFormat.contains(exclude)) { | ||
132 | 37 | return false; | ||
133 | 38 | } | ||
134 | 39 | } | ||
135 | 40 | |||
136 | 41 | Q_FOREACH(const QString& include, includes) { | ||
137 | 42 | if (strTimeFormat.contains(include)) { | ||
138 | 43 | return true; | ||
139 | 44 | } | ||
140 | 45 | } | ||
141 | 46 | |||
142 | 47 | return false; | ||
143 | 48 | } | ||
144 | 49 | |||
145 | 26 | typedef enum | 50 | typedef enum |
146 | 27 | { | 51 | { |
147 | 28 | DATE_PROXIMITY_NOW, | 52 | DATE_PROXIMITY_NOW, |
148 | 29 | 53 | ||
149 | === modified file 'tests/unit/tst_i18n/tst_i18n.pro' | |||
150 | --- tests/unit/tst_i18n/tst_i18n.pro 2015-05-18 09:53:55 +0000 | |||
151 | +++ tests/unit/tst_i18n/tst_i18n.pro 2015-08-12 10:11:44 +0000 | |||
152 | @@ -1,18 +1,3 @@ | |||
171 | 1 | include(../test-include.pri) | 1 | TEMPLATE = subdirs |
172 | 2 | QT += gui | 2 | SUBDIRS += tst_i18n_LocalizedApp |
173 | 3 | DEFINES += SRCDIR=\\\"$$PWD/\\\" | 3 | SUBDIRS += tst_i18n_RelativeTime |
156 | 4 | |||
157 | 5 | DOMAIN = localizedApp | ||
158 | 6 | mo.target = mo | ||
159 | 7 | mo.commands = set -e; | ||
160 | 8 | mo.commands += echo Generating localization for $$DOMAIN; | ||
161 | 9 | mo.commands += mkdir -p $${DOMAIN}/share/locale/en/LC_MESSAGES; | ||
162 | 10 | mo.commands += msgfmt $$PWD/po/en_US.po -o $${DOMAIN}/share/locale/en/LC_MESSAGES/$${DOMAIN}.mo; | ||
163 | 11 | QMAKE_EXTRA_TARGETS += mo | ||
164 | 12 | PRE_TARGETDEPS += mo | ||
165 | 13 | |||
166 | 14 | SOURCES += \ | ||
167 | 15 | src/tst_i18n.cpp | ||
168 | 16 | |||
169 | 17 | OTHER_FILES += \ | ||
170 | 18 | src/LocalizedApp.qml | ||
174 | 19 | 4 | ||
175 | === added directory 'tests/unit/tst_i18n/tst_i18n_LocalizedApp' | |||
176 | === added file 'tests/unit/tst_i18n/tst_i18n_LocalizedApp.o' | |||
177 | 20 | Binary files tests/unit/tst_i18n/tst_i18n_LocalizedApp.o 1970-01-01 00:00:00 +0000 and tests/unit/tst_i18n/tst_i18n_LocalizedApp.o 2015-08-12 10:11:44 +0000 differ | 5 | Binary files tests/unit/tst_i18n/tst_i18n_LocalizedApp.o 1970-01-01 00:00:00 +0000 and tests/unit/tst_i18n/tst_i18n_LocalizedApp.o 2015-08-12 10:11:44 +0000 differ |
178 | === renamed directory 'tests/unit/tst_i18n/localizedApp' => 'tests/unit/tst_i18n/tst_i18n_LocalizedApp/localizedApp' | |||
179 | === renamed directory 'tests/unit/tst_i18n/po' => 'tests/unit/tst_i18n/tst_i18n_LocalizedApp/po' | |||
180 | === renamed directory 'tests/unit/tst_i18n/src' => 'tests/unit/tst_i18n/tst_i18n_LocalizedApp/src' | |||
181 | === modified file 'tests/unit/tst_i18n/tst_i18n_LocalizedApp/src/LocalizedApp.qml' | |||
182 | --- tests/unit/tst_i18n/src/LocalizedApp.qml 2015-03-03 13:20:06 +0000 | |||
183 | +++ tests/unit/tst_i18n/tst_i18n_LocalizedApp/src/LocalizedApp.qml 2015-08-12 10:11:44 +0000 | |||
184 | @@ -28,7 +28,7 @@ | |||
185 | 28 | Button { | 28 | Button { |
186 | 29 | id: button | 29 | id: button |
187 | 30 | objectName: 'button' | 30 | objectName: 'button' |
189 | 31 | anchors.centerIn: parent | 31 | anchors.horizontalCenter: parent.horizontalCenter |
190 | 32 | text: i18n.tr('Count the kilometres') | 32 | text: i18n.tr('Count the kilometres') |
191 | 33 | width: units.gu(15) | 33 | width: units.gu(15) |
192 | 34 | } | 34 | } |
193 | @@ -60,5 +60,47 @@ | |||
194 | 60 | anchors.horizontalCenter: all2.horizontalCenter | 60 | anchors.horizontalCenter: all2.horizontalCenter |
195 | 61 | text: i18n.tag('All Cats', 'All') | 61 | text: i18n.tag('All Cats', 'All') |
196 | 62 | } | 62 | } |
197 | 63 | Label { | ||
198 | 64 | id: timeNow | ||
199 | 65 | objectName: 'timeNow' | ||
200 | 66 | anchors.top: all3.bottom | ||
201 | 67 | anchors.horizontalCenter: all3.horizontalCenter | ||
202 | 68 | text: i18n.relativeDateTime(new Date()) | ||
203 | 69 | } | ||
204 | 70 | Label { | ||
205 | 71 | id: timeMinuteBefore | ||
206 | 72 | objectName: 'timeMinuteBefore' | ||
207 | 73 | anchors.top: timeNow.bottom | ||
208 | 74 | anchors.horizontalCenter: timeNow.horizontalCenter | ||
209 | 75 | text: i18n.relativeDateTime(new Date(new Date().getTime() - 60000)) | ||
210 | 76 | } | ||
211 | 77 | Label { | ||
212 | 78 | id: timeMinuteAfter | ||
213 | 79 | objectName: 'timeMinuteAfter' | ||
214 | 80 | anchors.top: timeMinuteBefore.bottom | ||
215 | 81 | anchors.horizontalCenter: timeMinuteBefore.horizontalCenter | ||
216 | 82 | text: i18n.relativeDateTime(new Date(new Date().getTime() + 60000)) | ||
217 | 83 | } | ||
218 | 84 | Label { | ||
219 | 85 | id: tenMinutesBefore | ||
220 | 86 | objectName: 'tenMinutesBefore' | ||
221 | 87 | anchors.top: timeMinuteAfter.bottom | ||
222 | 88 | anchors.horizontalCenter: timeMinuteAfter.horizontalCenter | ||
223 | 89 | text: i18n.relativeDateTime(new Date(new Date().getTime() - 600000)) | ||
224 | 90 | } | ||
225 | 91 | Label { | ||
226 | 92 | id: tenMinutesAfter | ||
227 | 93 | objectName: 'tenMinutesAfter' | ||
228 | 94 | anchors.top: tenMinutesBefore.bottom | ||
229 | 95 | anchors.horizontalCenter: tenMinutesBefore.horizontalCenter | ||
230 | 96 | text: i18n.relativeDateTime(new Date(new Date().getTime() + 600000)) | ||
231 | 97 | } | ||
232 | 98 | Label { | ||
233 | 99 | id: timeFarAway | ||
234 | 100 | objectName: 'timeFarAway' | ||
235 | 101 | anchors.top: tenMinutesAfter.bottom | ||
236 | 102 | anchors.horizontalCenter: tenMinutesAfter.horizontalCenter | ||
237 | 103 | text: i18n.relativeDateTime(new Date(2000, 0, 1, 0, 0, 0, 0)) | ||
238 | 104 | } | ||
239 | 63 | } | 105 | } |
240 | 64 | } | 106 | } |
241 | 65 | 107 | ||
242 | === renamed file 'tests/unit/tst_i18n/src/tst_i18n.cpp' => 'tests/unit/tst_i18n/tst_i18n_LocalizedApp/src/tst_i18n_LocalizedApp.cpp' | |||
243 | --- tests/unit/tst_i18n/src/tst_i18n.cpp 2015-02-03 18:11:32 +0000 | |||
244 | +++ tests/unit/tst_i18n/tst_i18n_LocalizedApp/src/tst_i18n_LocalizedApp.cpp 2015-08-12 10:11:44 +0000 | |||
245 | @@ -39,7 +39,7 @@ | |||
246 | 39 | #include "ucunits.h" | 39 | #include "ucunits.h" |
247 | 40 | #include "i18n.h" | 40 | #include "i18n.h" |
248 | 41 | 41 | ||
250 | 42 | class tst_I18n : public QObject | 42 | class tst_I18n_LocalizedApp : public QObject |
251 | 43 | { | 43 | { |
252 | 44 | Q_OBJECT | 44 | Q_OBJECT |
253 | 45 | 45 | ||
254 | @@ -47,7 +47,7 @@ | |||
255 | 47 | QQuickView *view; | 47 | QQuickView *view; |
256 | 48 | 48 | ||
257 | 49 | public: | 49 | public: |
259 | 50 | tst_I18n() : | 50 | tst_I18n_LocalizedApp() : |
260 | 51 | view(0) | 51 | view(0) |
261 | 52 | { | 52 | { |
262 | 53 | } | 53 | } |
263 | @@ -191,7 +191,7 @@ | |||
264 | 191 | } | 191 | } |
265 | 192 | }; | 192 | }; |
266 | 193 | 193 | ||
268 | 194 | // The C++ equivalent of QTEST_MAIN(tst_I18n) with added initialization | 194 | // The C++ equivalent of QTEST_MAIN(tst_I18n_LocalizedApp) with added initialization |
269 | 195 | int main(int argc, char *argv[]) | 195 | int main(int argc, char *argv[]) |
270 | 196 | { | 196 | { |
271 | 197 | // LC_ALL would fail the test case; it must be unset before execution | 197 | // LC_ALL would fail the test case; it must be unset before execution |
272 | @@ -199,8 +199,8 @@ | |||
273 | 199 | 199 | ||
274 | 200 | QGuiApplication app(argc, argv); | 200 | QGuiApplication app(argc, argv); |
275 | 201 | app.setAttribute(Qt::AA_Use96Dpi, true); | 201 | app.setAttribute(Qt::AA_Use96Dpi, true); |
277 | 202 | tst_I18n* testObject = new tst_I18n(); | 202 | tst_I18n_LocalizedApp* testObject = new tst_I18n_LocalizedApp(); |
278 | 203 | return QTest::qExec(static_cast<QObject*>(testObject), argc, argv); | 203 | return QTest::qExec(static_cast<QObject*>(testObject), argc, argv); |
279 | 204 | } | 204 | } |
280 | 205 | 205 | ||
282 | 206 | #include "tst_i18n.moc" | 206 | #include "tst_i18n_LocalizedApp.moc" |
283 | 207 | 207 | ||
284 | === added file 'tests/unit/tst_i18n/tst_i18n_LocalizedApp/tst_i18n_LocalizedApp.pro' | |||
285 | --- tests/unit/tst_i18n/tst_i18n_LocalizedApp/tst_i18n_LocalizedApp.pro 1970-01-01 00:00:00 +0000 | |||
286 | +++ tests/unit/tst_i18n/tst_i18n_LocalizedApp/tst_i18n_LocalizedApp.pro 2015-08-12 10:11:44 +0000 | |||
287 | @@ -0,0 +1,17 @@ | |||
288 | 1 | include(../../test-include.pri) | ||
289 | 2 | QT += gui | ||
290 | 3 | DEFINES += SRCDIR=\\\"$$PWD/\\\" | ||
291 | 4 | |||
292 | 5 | DOMAIN = localizedApp | ||
293 | 6 | mo.target = mo | ||
294 | 7 | mo.commands = set -e; | ||
295 | 8 | mo.commands += echo Generating localization; | ||
296 | 9 | mo.commands += msgfmt po/en_US.po -o $${DOMAIN}/share/locale/en/LC_MESSAGES/$${DOMAIN}.mo; | ||
297 | 10 | QMAKE_EXTRA_TARGETS += mo | ||
298 | 11 | PRE_TARGETDEPS += mo | ||
299 | 12 | |||
300 | 13 | SOURCES += \ | ||
301 | 14 | src/tst_i18n_LocalizedApp.cpp | ||
302 | 15 | |||
303 | 16 | OTHER_FILES += \ | ||
304 | 17 | src/LocalizedApp.qml | ||
305 | 0 | 18 | ||
306 | === added directory 'tests/unit/tst_i18n/tst_i18n_RelativeTime' | |||
307 | === added file 'tests/unit/tst_i18n/tst_i18n_RelativeTime.o' | |||
308 | 1 | Binary files tests/unit/tst_i18n/tst_i18n_RelativeTime.o 1970-01-01 00:00:00 +0000 and tests/unit/tst_i18n/tst_i18n_RelativeTime.o 2015-08-12 10:11:44 +0000 differ | 19 | Binary files tests/unit/tst_i18n/tst_i18n_RelativeTime.o 1970-01-01 00:00:00 +0000 and tests/unit/tst_i18n/tst_i18n_RelativeTime.o 2015-08-12 10:11:44 +0000 differ |
309 | === added directory 'tests/unit/tst_i18n/tst_i18n_RelativeTime/po' | |||
310 | === added file 'tests/unit/tst_i18n/tst_i18n_RelativeTime/po/en_US.po' | |||
311 | --- tests/unit/tst_i18n/tst_i18n_RelativeTime/po/en_US.po 1970-01-01 00:00:00 +0000 | |||
312 | +++ tests/unit/tst_i18n/tst_i18n_RelativeTime/po/en_US.po 2015-08-12 10:11:44 +0000 | |||
313 | @@ -0,0 +1,54 @@ | |||
314 | 1 | msgid "" | ||
315 | 2 | msgstr "" | ||
316 | 3 | "Project-Id-Version: \n" | ||
317 | 4 | "POT-Creation-Date: \n" | ||
318 | 5 | "PO-Revision-Date: \n" | ||
319 | 6 | "Last-Translator: Christian Dywan <christian.dywan@canonical.com>\n" | ||
320 | 7 | "Language-Team: \n" | ||
321 | 8 | "Language: \n" | ||
322 | 9 | "MIME-Version: 1.0\n" | ||
323 | 10 | "Content-Type: text/plain; charset=iso-8859-1\n" | ||
324 | 11 | "Content-Transfer-Encoding: 8bit\n" | ||
325 | 12 | |||
326 | 13 | msgid "Now" | ||
327 | 14 | msgstr "tr:Now" | ||
328 | 15 | |||
329 | 16 | msgid "%1 minute ago" | ||
330 | 17 | msgid_plural "%1 minutes ago" | ||
331 | 18 | msgstr[0] "tr:%1 minute ago" | ||
332 | 19 | msgstr[1] "tr:%1 minutes ago" | ||
333 | 20 | |||
334 | 21 | msgid "%1 minute" | ||
335 | 22 | msgid_plural "%1 minutes" | ||
336 | 23 | msgstr[0] "tr:%1 minute" | ||
337 | 24 | msgstr[1] "tr:%1 minutes" | ||
338 | 25 | |||
339 | 26 | msgid "h:mm ap" | ||
340 | 27 | msgstr "'tr:'h:mm ap" | ||
341 | 28 | |||
342 | 29 | msgid "HH:mm" | ||
343 | 30 | msgstr "'tr:'HH:mm" | ||
344 | 31 | |||
345 | 32 | msgid "'Yesterday 'h:mm ap" | ||
346 | 33 | msgstr "'tr:Yesterday 'h:mm ap" | ||
347 | 34 | |||
348 | 35 | msgid "'Yesterday 'HH:mm" | ||
349 | 36 | msgstr "'tr:Yesterday 'HH:mm" | ||
350 | 37 | |||
351 | 38 | msgid "'Tomorrow 'h:mm ap" | ||
352 | 39 | msgstr "'tr:Tomorrow 'h:mm ap" | ||
353 | 40 | |||
354 | 41 | msgid "'Tomorrow 'HH:mm" | ||
355 | 42 | msgstr "'tr:Tomorrow 'HH:mm" | ||
356 | 43 | |||
357 | 44 | msgid "ddd' 'h:mm ap" | ||
358 | 45 | msgstr "'tr:'ddd' 'h:mm ap" | ||
359 | 46 | |||
360 | 47 | msgid "ddd' 'HH:mm" | ||
361 | 48 | msgstr "'tr:'ddd' 'HH:mm" | ||
362 | 49 | |||
363 | 50 | msgid "ddd d MMM' 'h:mm ap" | ||
364 | 51 | msgstr "'tr:FarAway'" | ||
365 | 52 | |||
366 | 53 | msgid "ddd d MMM' 'HH:mm" | ||
367 | 54 | msgstr "'tr:FarAway'" | ||
368 | 0 | 55 | ||
369 | === added directory 'tests/unit/tst_i18n/tst_i18n_RelativeTime/src' | |||
370 | === added file 'tests/unit/tst_i18n/tst_i18n_RelativeTime/src/RelativeTime.qml' | |||
371 | --- tests/unit/tst_i18n/tst_i18n_RelativeTime/src/RelativeTime.qml 1970-01-01 00:00:00 +0000 | |||
372 | +++ tests/unit/tst_i18n/tst_i18n_RelativeTime/src/RelativeTime.qml 2015-08-12 10:11:44 +0000 | |||
373 | @@ -0,0 +1,71 @@ | |||
374 | 1 | /* | ||
375 | 2 | * Copyright 2013 Canonical Ltd. | ||
376 | 3 | * | ||
377 | 4 | * This program is free software; you can redistribute it and/or modify | ||
378 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
379 | 6 | * the Free Software Foundation; version 3. | ||
380 | 7 | * | ||
381 | 8 | * This program is distributed in the hope that it will be useful, | ||
382 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
383 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
384 | 11 | * GNU Lesser General Public License for more details. | ||
385 | 12 | * | ||
386 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
387 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
388 | 15 | */ | ||
389 | 16 | |||
390 | 17 | import QtQuick 2.0 | ||
391 | 18 | import Ubuntu.Components 1.3 | ||
392 | 19 | |||
393 | 20 | MainView { | ||
394 | 21 | width: units.gu(48) | ||
395 | 22 | height: units.gu(60) | ||
396 | 23 | applicationName: "ubuntu-ui-toolkit" | ||
397 | 24 | |||
398 | 25 | Page { | ||
399 | 26 | objectName: 'page' | ||
400 | 27 | |||
401 | 28 | Label { | ||
402 | 29 | id: timeNow | ||
403 | 30 | objectName: 'timeNow' | ||
404 | 31 | anchors.top: parent.top | ||
405 | 32 | anchors.horizontalCenter: parent.horizontalCenter | ||
406 | 33 | text: i18n.relativeDateTime(new Date()) | ||
407 | 34 | } | ||
408 | 35 | Label { | ||
409 | 36 | id: timeMinuteBefore | ||
410 | 37 | objectName: 'timeMinuteBefore' | ||
411 | 38 | anchors.top: timeNow.bottom | ||
412 | 39 | anchors.horizontalCenter: timeNow.horizontalCenter | ||
413 | 40 | text: i18n.relativeDateTime(new Date(new Date().getTime() - 60000)) | ||
414 | 41 | } | ||
415 | 42 | Label { | ||
416 | 43 | id: timeMinuteAfter | ||
417 | 44 | objectName: 'timeMinuteAfter' | ||
418 | 45 | anchors.top: timeMinuteBefore.bottom | ||
419 | 46 | anchors.horizontalCenter: timeMinuteBefore.horizontalCenter | ||
420 | 47 | text: i18n.relativeDateTime(new Date(new Date().getTime() + 60000)) | ||
421 | 48 | } | ||
422 | 49 | Label { | ||
423 | 50 | id: tenMinutesBefore | ||
424 | 51 | objectName: 'tenMinutesBefore' | ||
425 | 52 | anchors.top: timeMinuteAfter.bottom | ||
426 | 53 | anchors.horizontalCenter: timeMinuteAfter.horizontalCenter | ||
427 | 54 | text: i18n.relativeDateTime(new Date(new Date().getTime() - 600000)) | ||
428 | 55 | } | ||
429 | 56 | Label { | ||
430 | 57 | id: tenMinutesAfter | ||
431 | 58 | objectName: 'tenMinutesAfter' | ||
432 | 59 | anchors.top: tenMinutesBefore.bottom | ||
433 | 60 | anchors.horizontalCenter: tenMinutesBefore.horizontalCenter | ||
434 | 61 | text: i18n.relativeDateTime(new Date(new Date().getTime() + 600000)) | ||
435 | 62 | } | ||
436 | 63 | Label { | ||
437 | 64 | id: timeFarAway | ||
438 | 65 | objectName: 'timeFarAway' | ||
439 | 66 | anchors.top: tenMinutesAfter.bottom | ||
440 | 67 | anchors.horizontalCenter: tenMinutesAfter.horizontalCenter | ||
441 | 68 | text: i18n.relativeDateTime(new Date(2000, 0, 1, 0, 0, 0, 0)) | ||
442 | 69 | } | ||
443 | 70 | } | ||
444 | 71 | } | ||
445 | 0 | 72 | ||
446 | === added file 'tests/unit/tst_i18n/tst_i18n_RelativeTime/src/tst_i18n_RelativeTime.cpp' | |||
447 | --- tests/unit/tst_i18n/tst_i18n_RelativeTime/src/tst_i18n_RelativeTime.cpp 1970-01-01 00:00:00 +0000 | |||
448 | +++ tests/unit/tst_i18n/tst_i18n_RelativeTime/src/tst_i18n_RelativeTime.cpp 2015-08-12 10:11:44 +0000 | |||
449 | @@ -0,0 +1,202 @@ | |||
450 | 1 | |||
451 | 2 | /* | ||
452 | 3 | * Copyright 2015 Canonical Ltd. | ||
453 | 4 | * | ||
454 | 5 | * This program is free software; you can redistribute it and/or modify | ||
455 | 6 | * it under the terms of the GNU Lesser General Public License as published by | ||
456 | 7 | * the Free Software Foundation; version 3. | ||
457 | 8 | * | ||
458 | 9 | * This program is distributed in the hope that it will be useful, | ||
459 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
460 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
461 | 12 | * GNU Lesser General Public License for more details. | ||
462 | 13 | * | ||
463 | 14 | * You should have received a copy of the GNU Lesser General Public License | ||
464 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
465 | 16 | * | ||
466 | 17 | * Author: Nick Dedekind <nick.dedekind@gmail.com> | ||
467 | 18 | */ | ||
468 | 19 | |||
469 | 20 | #include <QtCore/QString> | ||
470 | 21 | #include <QtCore/QTextCodec> | ||
471 | 22 | #include <QtCore/QStandardPaths> | ||
472 | 23 | #include <QtCore/QDir> | ||
473 | 24 | #include <QtCore/QProcessEnvironment> | ||
474 | 25 | #include <QtTest/QTest> | ||
475 | 26 | #include <QtTest/QSignalSpy> | ||
476 | 27 | #include <QtCore/QCoreApplication> | ||
477 | 28 | #include <QtQml/QQmlEngine> | ||
478 | 29 | #include <QtQuick/QQuickView> | ||
479 | 30 | #include <QtQuick/QQuickItem> | ||
480 | 31 | #include <QtCore/QThread> | ||
481 | 32 | #include <QtCore/QFileInfo> | ||
482 | 33 | #include <QtCore/QDir> | ||
483 | 34 | #include <QtTest/qtest_gui.h> | ||
484 | 35 | |||
485 | 36 | namespace C { | ||
486 | 37 | #include <libintl.h> | ||
487 | 38 | } | ||
488 | 39 | |||
489 | 40 | #include "ucunits.h" | ||
490 | 41 | #include "i18n.h" | ||
491 | 42 | |||
492 | 43 | class tst_I18n_RelativeTime : public QObject | ||
493 | 44 | { | ||
494 | 45 | Q_OBJECT | ||
495 | 46 | |||
496 | 47 | private: | ||
497 | 48 | QQuickView *view; | ||
498 | 49 | |||
499 | 50 | public: | ||
500 | 51 | tst_I18n_RelativeTime() : | ||
501 | 52 | view(0) | ||
502 | 53 | { | ||
503 | 54 | } | ||
504 | 55 | |||
505 | 56 | QQuickItem *loadTest(const QString &document) | ||
506 | 57 | { | ||
507 | 58 | // load the document | ||
508 | 59 | view->setSource(QUrl::fromLocalFile(document)); | ||
509 | 60 | QTest::waitForEvents(); | ||
510 | 61 | |||
511 | 62 | return view->rootObject(); | ||
512 | 63 | } | ||
513 | 64 | |||
514 | 65 | QQuickItem *testItem(QQuickItem *that, const QString &identifier) | ||
515 | 66 | { | ||
516 | 67 | if (that->property(identifier.toLocal8Bit()).isValid()) | ||
517 | 68 | return that->property(identifier.toLocal8Bit()).value<QQuickItem*>(); | ||
518 | 69 | |||
519 | 70 | QList<QQuickItem*> children = that->findChildren<QQuickItem*>(identifier); | ||
520 | 71 | return (children.count() > 0) ? children[0] : 0; | ||
521 | 72 | } | ||
522 | 73 | |||
523 | 74 | private Q_SLOTS: | ||
524 | 75 | |||
525 | 76 | void initTestCase() | ||
526 | 77 | { | ||
527 | 78 | // Set test locale folder in the environment | ||
528 | 79 | // Using setenv because QProcessEnvironment ignores changes | ||
529 | 80 | QString testAppDir(QDir::currentPath() + "/ubuntu-ui-toolkit"); | ||
530 | 81 | setenv("APP_DIR", testAppDir.toUtf8(), 1); | ||
531 | 82 | |||
532 | 83 | // Verify that we set it correctly | ||
533 | 84 | QVERIFY(QFileInfo(testAppDir + "/share/locale/en/LC_MESSAGES/ubuntu-ui-toolkit.mo").exists()); | ||
534 | 85 | |||
535 | 86 | QString modules(UBUNTU_QML_IMPORT_PATH); | ||
536 | 87 | QVERIFY(QDir(modules).exists()); | ||
537 | 88 | |||
538 | 89 | view = new QQuickView; | ||
539 | 90 | QQmlEngine *quickEngine = view->engine(); | ||
540 | 91 | |||
541 | 92 | view->setGeometry(0,0, UCUnits::instance().gu(40), UCUnits::instance().gu(30)); | ||
542 | 93 | //add modules folder so we have access to the plugin from QML | ||
543 | 94 | QStringList imports = quickEngine->importPathList(); | ||
544 | 95 | imports.prepend(QDir(modules).absolutePath()); | ||
545 | 96 | quickEngine->setImportPathList(imports); | ||
546 | 97 | } | ||
547 | 98 | |||
548 | 99 | void cleanupTestCase() | ||
549 | 100 | { | ||
550 | 101 | delete view; | ||
551 | 102 | } | ||
552 | 103 | |||
553 | 104 | void testCase_RelativeTime() | ||
554 | 105 | { | ||
555 | 106 | UbuntuI18n* i18n = &UbuntuI18n::instance(); | ||
556 | 107 | // By default no domain is set | ||
557 | 108 | QCOMPARE(i18n->domain(), QString("")); | ||
558 | 109 | |||
559 | 110 | // Start out with no localization | ||
560 | 111 | i18n->setLanguage("C"); | ||
561 | 112 | // Load the app which should pick up the locale we prepared | ||
562 | 113 | QQuickItem *root = loadTest("src/RelativeTime.qml"); | ||
563 | 114 | QVERIFY(root); | ||
564 | 115 | QQuickItem *mainView = root; | ||
565 | 116 | |||
566 | 117 | // There no translation happens | ||
567 | 118 | QQuickItem* page(testItem(mainView, "page")); | ||
568 | 119 | QVERIFY(page); | ||
569 | 120 | |||
570 | 121 | QQuickItem* timeFarAway(testItem(page, "timeFarAway")); | ||
571 | 122 | QVERIFY(timeFarAway); | ||
572 | 123 | QCOMPARE(timeFarAway->property("text").toString(), | ||
573 | 124 | QDateTime(QDate(2000,1,1), QTime(0,0,0,0)).toString("ddd d MMM'\u2003'HH:mm")); | ||
574 | 125 | QQuickItem* timeNow(testItem(page, "timeNow")); | ||
575 | 126 | QVERIFY(timeNow); | ||
576 | 127 | QCOMPARE(timeNow->property("text").toString(), QString("Now")); | ||
577 | 128 | QQuickItem* timeMinuteBefore(testItem(page, "timeMinuteBefore")); | ||
578 | 129 | QVERIFY(timeMinuteBefore); | ||
579 | 130 | QCOMPARE(timeMinuteBefore->property("text").toString(), QString("1 minute ago")); | ||
580 | 131 | QQuickItem* timeMinuteAfter(testItem(page, "timeMinuteAfter")); | ||
581 | 132 | QVERIFY(timeMinuteAfter); | ||
582 | 133 | QCOMPARE(timeMinuteAfter->property("text").toString(), QString("1 minute")); | ||
583 | 134 | QQuickItem* tenMinutesBefore(testItem(page, "tenMinutesBefore")); | ||
584 | 135 | QVERIFY(tenMinutesBefore); | ||
585 | 136 | QCOMPARE(tenMinutesBefore->property("text").toString(), QString("10 minutes ago")); | ||
586 | 137 | QQuickItem* tenMinutesAfter(testItem(page, "tenMinutesAfter")); | ||
587 | 138 | QVERIFY(tenMinutesAfter); | ||
588 | 139 | QCOMPARE(tenMinutesAfter->property("text").toString(), QString("10 minutes")); | ||
589 | 140 | |||
590 | 141 | // There no translation happens in C++ either | ||
591 | 142 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime()), QString("Now")); | ||
592 | 143 | QCOMPARE(i18n->relativeDateTime(QDateTime(QDate(2000,1,1), QTime(0,0,0,0))), | ||
593 | 144 | QDateTime(QDate(2000,1,1), QTime(0,0,0,0)).toString("ddd d MMM'\u2003'HH:mm")); | ||
594 | 145 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime().addSecs(-60)), QString("1 minute ago")); | ||
595 | 146 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime().addSecs(60)), QString("1 minute")); | ||
596 | 147 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime().addSecs(-600)), QString("10 minutes ago")); | ||
597 | 148 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime().addSecs(600)), QString("10 minutes")); | ||
598 | 149 | |||
599 | 150 | // Was the locale folder detected and set? | ||
600 | 151 | QString boundDomain(C::bindtextdomain(i18n->domain().toUtf8(), ((const char*)0))); | ||
601 | 152 | QString testAppDir(QDir::currentPath() + "/ubuntu-ui-toolkit"); | ||
602 | 153 | QString expectedLocalePath(QDir(testAppDir).filePath("share/locale")); | ||
603 | 154 | QCOMPARE(boundDomain, expectedLocalePath); | ||
604 | 155 | // Is the domain gettext uses correct? | ||
605 | 156 | QString gettextDomain(C::textdomain(((const char*)0))); | ||
606 | 157 | QCOMPARE(gettextDomain, i18n->domain()); | ||
607 | 158 | // Is the compiled en_US message catalog in the right location? | ||
608 | 159 | QString messageCatalog(boundDomain + "/en/LC_MESSAGES/ubuntu-ui-toolkit.mo"); | ||
609 | 160 | QVERIFY(QFileInfo(messageCatalog).exists()); | ||
610 | 161 | |||
611 | 162 | // Check if system has en_US locale, otherwise gettext won't work | ||
612 | 163 | QProcess localeA; | ||
613 | 164 | localeA.start("locale -a"); | ||
614 | 165 | QVERIFY(localeA.waitForFinished()); | ||
615 | 166 | QVERIFY(QString(localeA.readAll()).split("\n").contains("en_US.utf8")); | ||
616 | 167 | |||
617 | 168 | i18n->setLanguage("en_US.utf8"); | ||
618 | 169 | QSignalSpy spy(i18n, SIGNAL(languageChanged())); | ||
619 | 170 | spy.wait(); | ||
620 | 171 | |||
621 | 172 | // Inspect translated strings in QML | ||
622 | 173 | QCOMPARE(timeNow->property("text").toString(), QString("tr:Now")); | ||
623 | 174 | QCOMPARE(timeMinuteBefore->property("text").toString(), QString("tr:1 minute ago")); | ||
624 | 175 | QCOMPARE(timeMinuteAfter->property("text").toString(), QString("tr:1 minute")); | ||
625 | 176 | QCOMPARE(tenMinutesBefore->property("text").toString(), QString("tr:10 minutes ago")); | ||
626 | 177 | QCOMPARE(tenMinutesAfter->property("text").toString(), QString("tr:10 minutes")); | ||
627 | 178 | QCOMPARE(timeFarAway->property("text").toString(), QString("tr:FarAway")); | ||
628 | 179 | |||
629 | 180 | // Translate in C++ | ||
630 | 181 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime()), QString("tr:Now")); | ||
631 | 182 | QCOMPARE(i18n->relativeDateTime(QDateTime(QDate(2000,1,1), QTime(0,0,0,0))), QString("tr:FarAway")); | ||
632 | 183 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime().addSecs(-60)), QString("tr:1 minute ago")); | ||
633 | 184 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime().addSecs(60)), QString("tr:1 minute")); | ||
634 | 185 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime().addSecs(-600)), QString("tr:10 minutes ago")); | ||
635 | 186 | QCOMPARE(i18n->relativeDateTime(QDateTime::currentDateTime().addSecs(600)), QString("tr:10 minutes")); | ||
636 | 187 | } | ||
637 | 188 | }; | ||
638 | 189 | |||
639 | 190 | // The C++ equivalent of QTEST_MAIN(tst_I18n_RelativeTime) with added initialization | ||
640 | 191 | int main(int argc, char *argv[]) | ||
641 | 192 | { | ||
642 | 193 | // LC_ALL would fail the test case; it must be unset before execution | ||
643 | 194 | unsetenv("LC_ALL"); | ||
644 | 195 | |||
645 | 196 | QGuiApplication app(argc, argv); | ||
646 | 197 | app.setAttribute(Qt::AA_Use96Dpi, true); | ||
647 | 198 | tst_I18n_RelativeTime* testObject = new tst_I18n_RelativeTime(); | ||
648 | 199 | return QTest::qExec(static_cast<QObject*>(testObject), argc, argv); | ||
649 | 200 | } | ||
650 | 201 | |||
651 | 202 | #include "tst_i18n_RelativeTime.moc" | ||
652 | 0 | 203 | ||
653 | === added file 'tests/unit/tst_i18n/tst_i18n_RelativeTime/tst_i18n_RelativeTime.pro' | |||
654 | --- tests/unit/tst_i18n/tst_i18n_RelativeTime/tst_i18n_RelativeTime.pro 1970-01-01 00:00:00 +0000 | |||
655 | +++ tests/unit/tst_i18n/tst_i18n_RelativeTime/tst_i18n_RelativeTime.pro 2015-08-12 10:11:44 +0000 | |||
656 | @@ -0,0 +1,17 @@ | |||
657 | 1 | include(../../test-include.pri) | ||
658 | 2 | QT += gui | ||
659 | 3 | DEFINES += SRCDIR=\\\"$$PWD/\\\" | ||
660 | 4 | |||
661 | 5 | DOMAIN = ubuntu-ui-toolkit | ||
662 | 6 | mo.target = mo | ||
663 | 7 | mo.commands = set -e; | ||
664 | 8 | mo.commands += echo Generating localization; | ||
665 | 9 | mo.commands += msgfmt po/en_US.po -o $${DOMAIN}/share/locale/en/LC_MESSAGES/$${DOMAIN}.mo; | ||
666 | 10 | QMAKE_EXTRA_TARGETS += mo | ||
667 | 11 | PRE_TARGETDEPS += mo | ||
668 | 12 | |||
669 | 13 | SOURCES += \ | ||
670 | 14 | src/tst_i18n_RelativeTime.cpp | ||
671 | 15 | |||
672 | 16 | OTHER_FILES += \ | ||
673 | 17 | src/RelativeTime.qml | ||
674 | 0 | 18 | ||
675 | === added directory 'tests/unit/tst_i18n/tst_i18n_RelativeTime/ubuntu-ui-toolkit' | |||
676 | === added directory 'tests/unit/tst_i18n/tst_i18n_RelativeTime/ubuntu-ui-toolkit/share' | |||
677 | === added directory 'tests/unit/tst_i18n/tst_i18n_RelativeTime/ubuntu-ui-toolkit/share/locale' | |||
678 | === added directory 'tests/unit/tst_i18n/tst_i18n_RelativeTime/ubuntu-ui-toolkit/share/locale/en' | |||
679 | === added directory 'tests/unit/tst_i18n/tst_i18n_RelativeTime/ubuntu-ui-toolkit/share/locale/en/LC_MESSAGES' |
It's just a re-merged version of https:/ /code.launchpad .net/~nick- dedekind/ ubuntu- ui-toolkit/ i18n-RelativeDa teTime/ +merge/ 265282