Merge lp:~renatofilho/mediaplayer-app/i18n into lp:mediaplayer-app
- i18n
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Olivier Tilloy |
Approved revision: | 93 |
Merged at revision: | 86 |
Proposed branch: | lp:~renatofilho/mediaplayer-app/i18n |
Merge into: | lp:mediaplayer-app |
Prerequisite: | lp:~renatofilho/mediaplayer-app/rename |
Diff against target: |
267 lines (+158/-11) 9 files modified
.bzrignore (+1/-0) CMakeLists.txt (+1/-0) debian/control (+1/-0) debian/mediaplayer-app.install (+1/-0) po/CMakeLists.txt (+25/-0) po/mediaplayer-app.pot (+58/-0) po/pt_BR.po (+56/-0) src/qml/player.qml (+8/-4) src/qml/player/TimeLine.qml (+7/-7) |
To merge this branch: | bzr merge lp:~renatofilho/mediaplayer-app/i18n |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Olivier Tilloy | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
David Planella (community) | Needs Fixing | ||
Review via email: mp+164916@code.launchpad.net |
Commit message
Initial support for i18n
Description of the change
- 85. By Renato Araujo Oliveira Filho
-
Added "po" dir
PS Jenkins bot (ps-jenkins) wrote : | # |
Olivier Tilloy (osomon) wrote : | # |
In src/qml/
- the formatProgress() function should take care of internationaliz
- strings in _slider.
- the property change in the "DEGRESSIVE" state should also be properly internationalized (prepending a "- " to the internationalized string is not correct)
Olivier Tilloy (osomon) wrote : | # |
In src/qml/player.qml, the HUD keywords should also be internationalized.
Olivier Tilloy (osomon) wrote : | # |
86 +#: /home/renato/
Not a big deal, but you can ensure the comments don’t include a full path, by invoking xgettext with the -D option, and passing relative file names.
Olivier Tilloy (osomon) wrote : | # |
114 +"X-Launchpad-
115 +"X-Generator: Launchpad (build 16626)\n"
Out of curiosity, where did you get that from? https:/
- 86. By Renato Araujo Oliveira Filho
-
Added more strings to translate.
- 87. By Renato Araujo Oliveira Filho
-
Updated translation file.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:87
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 88. By Renato Araujo Oliveira Filho
-
Created a target to generate pot file. ¨make create-pot¨
Fixed files path on pot file. - 89. By Renato Araujo Oliveira Filho
-
Fixed string used on translations.
Olivier Tilloy (osomon) wrote : | # |
255 - if (secs < 10) secs = "0" + secs
256 - if (min < 10) min = "0" + min
257 - if (hour < 10) hour = "0" + hour
258 + if (secs < 10) secs = i18n.tr("0") + secs
259 + if (min < 10) min = i18n.tr("0") + min
260 + if (hour < 10) hour = i18n.tr("0") + hour
261
262 - return hour + ":" + min + ":" + secs
263 + return i18n.tr(
That’s not proper internationaliz
return new Date(0, 0, 0, hour, min, sec).toLocaleTi
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:88
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
Renato Araujo Oliveira Filho (renatofilho) wrote : | # |
> 255 - if (secs < 10) secs = "0" + secs
> 256 - if (min < 10) min = "0" + min
> 257 - if (hour < 10) hour = "0" + hour
> 258 + if (secs < 10) secs = i18n.tr("0") + secs
> 259 + if (min < 10) min = i18n.tr("0") + min
> 260 + if (hour < 10) hour = i18n.tr("0") + hour
> 261
> 262 - return hour + ":" + min + ":" + secs
> 263 + return i18n.tr(
>
> That’s not proper internationaliz
> out there the time is displayed like e.g. 23:05:47, which is not necessarily
> correct. Please use proper localization functions operating on Date objects,
> i.e. something like that:
>
> return new Date(0, 0, 0, hour, min, sec).toLocaleTi
> "HH:mm:ss")
I can not use this function to format the video duration, because this is a interval and not a real time.
For example 23:40:01 must be always 23:40:01 and never 11:40:01 PM.
- 90. By Renato Araujo Oliveira Filho
-
Fixed i18n format for duration.
Olivier Tilloy (osomon) wrote : | # |
66 + add_custom_
To ease the future integration with dh_translations, could you rename this target to ${DOMAIN}.pot ?
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:90
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 91. By Renato Araujo Oliveira Filho
-
Renamed pot target in cmake.
Olivier Tilloy (osomon) wrote : | # |
68 + COMMAND ${XGETTEXT_
You’re passing "--keyword=tr" and "-kWORD=tr", which is redundant (and I believe the latter is incorrect syntax anyway, so you should remove it).
Olivier Tilloy (osomon) wrote : | # |
236 + _timeLine.
240 + _timeLine.
You have a problem with unicode, don’t you? ;)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:91
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
David Planella (dpm) wrote : | # |
68 + COMMAND ${XGETTEXT_
Also, --keyword=tr:1,2 needs to be added to handle plural forms here
David Planella (dpm) wrote : | # |
In Olivier's suggestion:
return new Date(0, 0, 0, hour, min, sec).toLocaleTi
The "HH:mm:ss" string should probably be read from the default locale setting for time format if possible. Otherwise, if it's not possible or if we haven't got the hooks to get it, then we should also mark that string for translation (i.e. i18n.tr(
- 92. By Renato Araujo Oliveira Filho
-
Fixed invalid function name.
- 93. By Renato Araujo Oliveira Filho
-
Fixed xgettext command arguments.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:93
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
David Planella (dpm) wrote : | # |
Hm, I guess I was too late to comment, as this has now been merged, but there are a couple of things that I noticed:
236 + _timeLine.
Could we add a comment for translators above this line? This would give them some more context about how to translate that string. If the word TRANSLATORS is included, xgettext will pick it up, put it in the .pot file and make the comment visible in Launchpad. E.g.
// TRANSLATORS: this refers to an unknown amount of time.
240 + _timeLine.
Rather than translating the initial value explicitly, is there no way to use something similar to strftime in QML? E.g. "%H:%M:%S", mark this as translatable and initialize currentTime as 0?
265 + return i18n.tr(
Same comment as above, if possible, I'd suggest using an strftime-formatted string.
If there isn't another way, I'd recommend adding a translators comment, as otherwise translators will not know how to translate this one at all.
Renato Araujo Oliveira Filho (renatofilho) wrote : | # |
I have create a new MR with this comments, check: https:/
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2012-10-24 09:09:28 +0000 |
3 | +++ .bzrignore 2013-05-22 17:30:47 +0000 |
4 | @@ -1,1 +1,2 @@ |
5 | CMakeLists.txt.* |
6 | +po/*.gmo |
7 | |
8 | === modified file 'CMakeLists.txt' |
9 | --- CMakeLists.txt 2013-05-20 19:46:02 +0000 |
10 | +++ CMakeLists.txt 2013-05-22 17:30:47 +0000 |
11 | @@ -26,6 +26,7 @@ |
12 | add_subdirectory(sdk) |
13 | add_subdirectory(src) |
14 | add_subdirectory(tests) |
15 | +add_subdirectory(po) |
16 | |
17 | configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) |
18 | |
19 | |
20 | === modified file 'debian/control' |
21 | --- debian/control 2013-05-09 13:23:11 +0000 |
22 | +++ debian/control 2013-05-22 17:30:47 +0000 |
23 | @@ -4,6 +4,7 @@ |
24 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
25 | Build-Depends: cmake, |
26 | debhelper (>= 9), |
27 | + gettext, |
28 | libgl1-mesa-dev[i386 amd64] | libgl-dev[i386 amd64], |
29 | libgles2-mesa-dev[armhf], |
30 | libgstreamer0.10-dev, |
31 | |
32 | === modified file 'debian/mediaplayer-app.install' |
33 | --- debian/mediaplayer-app.install 2013-05-20 19:46:02 +0000 |
34 | +++ debian/mediaplayer-app.install 2013-05-22 17:30:47 +0000 |
35 | @@ -2,3 +2,4 @@ |
36 | /usr/share/icons/hicolor/scalable/apps/mediaplayer-app.svg |
37 | /usr/bin/mediaplayer-app |
38 | /usr/share/mediaplayer-app/qml/* |
39 | +/usr/share/locale/*/LC_MESSAGES/mediaplayer-app.mo |
40 | |
41 | === added directory 'po' |
42 | === added file 'po/CMakeLists.txt' |
43 | --- po/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
44 | +++ po/CMakeLists.txt 2013-05-22 17:30:47 +0000 |
45 | @@ -0,0 +1,25 @@ |
46 | +project(mediaplayer-translations) |
47 | + |
48 | +include(FindGettext) |
49 | + |
50 | +set(DOMAIN mediaplayer-app) |
51 | +set(POT_FILE ${DOMAIN}.pot) |
52 | +file(GLOB PO_FILES *.po) |
53 | +file(GLOB_RECURSE QML_SRCS RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/*.qml) |
54 | + |
55 | +foreach(PO_FILE ${PO_FILES}) |
56 | + get_filename_component(LANG ${PO_FILE} NAME_WE) |
57 | + gettext_process_po_files(${LANG} ALL PO_FILES ${PO_FILE}) |
58 | + set(INSTALL_DIR ${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES) |
59 | + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo |
60 | + DESTINATION ${INSTALL_DIR} |
61 | + RENAME ${DOMAIN}.mo) |
62 | +endforeach(PO_FILE) |
63 | + |
64 | +find_program(XGETTEXT_EXECUTABLE xgettext) |
65 | +if(XGETTEXT_EXECUTABLE) |
66 | + add_custom_target(${POT_FILE}) |
67 | + add_custom_command(TARGET ${POT_FILE} |
68 | + COMMAND ${XGETTEXT_EXECUTABLE} --c++ --qt --add-comments=TRANSLATORS --keyword=tr --keyword=tr:1,2 -D ${CMAKE_SOURCE_DIR} -s -p ${CMAKE_CURRENT_SOURCE_DIR} -o mediaplayer-app.pot ${QML_SRCS} |
69 | + ) |
70 | +endif() |
71 | |
72 | === added file 'po/mediaplayer-app.pot' |
73 | --- po/mediaplayer-app.pot 1970-01-01 00:00:00 +0000 |
74 | +++ po/mediaplayer-app.pot 2013-05-22 17:30:47 +0000 |
75 | @@ -0,0 +1,58 @@ |
76 | +# SOME DESCRIPTIVE TITLE. |
77 | +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
78 | +# This file is distributed under the same license as the PACKAGE package. |
79 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
80 | +# |
81 | +#, fuzzy |
82 | +msgid "" |
83 | +msgstr "" |
84 | +"Project-Id-Version: PACKAGE VERSION\n" |
85 | +"Report-Msgid-Bugs-To: \n" |
86 | +"POT-Creation-Date: 2013-05-22 12:36-0300\n" |
87 | +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
88 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
89 | +"Language-Team: LANGUAGE <LL@li.org>\n" |
90 | +"Language: \n" |
91 | +"MIME-Version: 1.0\n" |
92 | +"Content-Type: text/plain; charset=CHARSET\n" |
93 | +"Content-Transfer-Encoding: 8bit\n" |
94 | + |
95 | +#: src/qml/player/TimeLine.qml:133 |
96 | +#, qt-format |
97 | +msgid "%1:%2:%3" |
98 | +msgstr "" |
99 | + |
100 | +#: src/qml/player/TimeLine.qml:102 |
101 | +#, qt-format |
102 | +msgid "- %1" |
103 | +msgstr "" |
104 | + |
105 | +#: src/qml/player/TimeLine.qml:129 src/qml/player/TimeLine.qml:130 |
106 | +#: src/qml/player/TimeLine.qml:131 |
107 | +#, qt-format |
108 | +msgid "0%1" |
109 | +msgstr "" |
110 | + |
111 | +#: src/qml/player/TimeLine.qml:69 |
112 | +msgid "0:00:00" |
113 | +msgstr "" |
114 | + |
115 | +#: src/qml/player.qml:159 |
116 | +msgid "Pause or Resume Playhead" |
117 | +msgstr "" |
118 | + |
119 | +#: src/qml/player.qml:158 |
120 | +msgid "Play / Pause" |
121 | +msgstr "" |
122 | + |
123 | +#: src/qml/player.qml:163 |
124 | +msgid "Post;Upload;Attach" |
125 | +msgstr "" |
126 | + |
127 | +#: src/qml/player.qml:162 |
128 | +msgid "Share" |
129 | +msgstr "" |
130 | + |
131 | +#: src/qml/player/TimeLine.qml:66 |
132 | +msgid "unknown" |
133 | +msgstr "" |
134 | |
135 | === added file 'po/pt_BR.po' |
136 | --- po/pt_BR.po 1970-01-01 00:00:00 +0000 |
137 | +++ po/pt_BR.po 2013-05-22 17:30:47 +0000 |
138 | @@ -0,0 +1,56 @@ |
139 | +# Brazilian Portuguese translation for webbrowser-app |
140 | +# Copyright (c) 2013 Canonical Ltd 2013 |
141 | +# This file is distributed under the same license as the webbrowser-app package. |
142 | +# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. |
143 | +# |
144 | +msgid "" |
145 | +msgstr "" |
146 | +"Project-Id-Version: mediaplayer-app\n" |
147 | +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
148 | +"POT-Creation-Date: 2013-05-16 18:13+0200\n" |
149 | +"PO-Revision-Date: 2013-05-17 14:27+0000\n" |
150 | +"Last-Translator: Renato Araujo Oliveira Filho <renato@canonical.com>\n" |
151 | +"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n" |
152 | +"MIME-Version: 1.0\n" |
153 | +"Content-Type: text/plain; charset=UTF-8\n" |
154 | +"Content-Transfer-Encoding: 8bit\n" |
155 | + |
156 | +#: src/qml/player/TimeLine.qml:133 |
157 | +#, qt-format |
158 | +msgid "%1:%2:%3" |
159 | +msgstr "%1:%2:%3" |
160 | + |
161 | +#: src/qml/player/TimeLine.qml:102 |
162 | +#, qt-format |
163 | +msgid "- %1" |
164 | +msgstr "- %1" |
165 | + |
166 | +#: src/qml/player/TimeLine.qml:129 src/qml/player/TimeLine.qml:130 |
167 | +#: src/qml/player/TimeLine.qml:131 |
168 | +#, qt-format |
169 | +msgid "0%1" |
170 | +msgstr "0%1" |
171 | + |
172 | +#: src/qml/player/TimeLine.qml:69 |
173 | +msgid "0:00:00" |
174 | +msgstr "0:00:00" |
175 | + |
176 | +#: src/qml/player.qml:159 |
177 | +msgid "Pause or Resume Playhead" |
178 | +msgstr "Pause ou Continue" |
179 | + |
180 | +#: src/qml/player.qml:158 |
181 | +msgid "Play / Pause" |
182 | +msgstr "Play / Pause" |
183 | + |
184 | +#: src/qml/player.qml:163 |
185 | +msgid "Post;Upload;Attach" |
186 | +msgstr "Postar;Carregar;Anexar" |
187 | + |
188 | +#: src/qml/player.qml:162 |
189 | +msgid "Share" |
190 | +msgstr "Compartilhar" |
191 | + |
192 | +#: src/qml/player/TimeLine.qml:66 |
193 | +msgid "unknown" |
194 | +msgstr "desconhecido" |
195 | |
196 | === modified file 'src/qml/player.qml' |
197 | --- src/qml/player.qml 2013-05-20 19:46:02 +0000 |
198 | +++ src/qml/player.qml 2013-05-22 17:30:47 +0000 |
199 | @@ -47,6 +47,10 @@ |
200 | mediaPlayer.orientation = Screen.angleBetween(Screen.primaryOrientation, Screen.orientation) |
201 | } |
202 | |
203 | + Component.onCompleted: { |
204 | + i18n.domain = "mediaplayer-app" |
205 | + } |
206 | + |
207 | Loader { |
208 | id: playerLoader |
209 | source: "player/VideoPlayer.qml" |
210 | @@ -151,12 +155,12 @@ |
211 | } |
212 | |
213 | HUD.Action { |
214 | - label: "Play / Pause" |
215 | - keywords: "Pause or Resume Playhead" |
216 | + label: i18n.tr("Play / Pause") |
217 | + keywords: i18n.tr("Pause or Resume Playhead") |
218 | } |
219 | HUD.Action { |
220 | - label: "Share" |
221 | - keywords: "Post;Upload;Attach" |
222 | + label: i18n.tr("Share") |
223 | + keywords: i18n.tr("Post;Upload;Attach") |
224 | } |
225 | } |
226 | } |
227 | |
228 | === modified file 'src/qml/player/TimeLine.qml' |
229 | --- src/qml/player/TimeLine.qml 2013-05-08 20:03:38 +0000 |
230 | +++ src/qml/player/TimeLine.qml 2013-05-22 17:30:47 +0000 |
231 | @@ -63,10 +63,10 @@ |
232 | if (_slider.maximumValue > 0) { |
233 | _timeLine.remainingTime = formatProgress(_slider.maximumValue - value) |
234 | } else { |
235 | - _timeLine.remainingTime = "unknow" |
236 | + _timeLine.remainingTime = i18n.tr("unknown") |
237 | } |
238 | } else { |
239 | - _timeLine.currentTime = "0:00:00" |
240 | + _timeLine.currentTime = i18n.tr("0:00:00") |
241 | } |
242 | } |
243 | |
244 | @@ -99,7 +99,7 @@ |
245 | }, |
246 | State { |
247 | name: "DEGRESSIVE" |
248 | - PropertyChanges { target: _TimeLabel; text: "- " + _timeLine.remainingTime } |
249 | + PropertyChanges { target: _TimeLabel; text: i18n.tr("- %1").arg(_timeLine.remainingTime) } |
250 | } |
251 | ] |
252 | |
253 | @@ -126,10 +126,10 @@ |
254 | min = time % 60 |
255 | hour = Math.floor(time / 60) |
256 | |
257 | - if (secs < 10) secs = "0" + secs |
258 | - if (min < 10) min = "0" + min |
259 | - if (hour < 10) hour = "0" + hour |
260 | + if (secs < 10) secs = i18n.tr("0%1").arg(secs) |
261 | + if (min < 10) min = i18n.tr("0%1").arg(min) |
262 | + if (hour < 10) hour = i18n.tr("0%1").arg(hour) |
263 | |
264 | - return hour + ":" + min + ":" + secs |
265 | + return i18n.tr("%1:%2:%3").arg(hour).arg(min).arg(secs) |
266 | } |
267 | } |
PASSED: Continuous integration, rev:85 jenkins. qa.ubuntu. com/job/ mediaplayer- app-ci/ 47/ jenkins. qa.ubuntu. com/job/ mediaplayer- app-raring- amd64-ci/ 18 jenkins. qa.ubuntu. com/job/ mediaplayer- app-raring- armhf-ci/ 46 jenkins. qa.ubuntu. com/job/ mediaplayer- app-raring- armhf-ci/ 46/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mediaplayer- app-raring- i386-ci/ 46 jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner/ 1571
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ mediaplayer- app-ci/ 47/rebuild
http://