Merge lp:~unity-api-team/unity-scope-snappy/add_gettext_to_vendors into lp:~unity-api-team/unity-scope-snappy/trunk
- add_gettext_to_vendors
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~unity-api-team/unity-scope-snappy/add_gettext_to_vendors |
Merge into: | lp:~unity-api-team/unity-scope-snappy/trunk |
Diff against target: |
579 lines (+473/-10) 6 files modified
debian/copyright (+4/-0) internal/github.com/gosexy/gettext/LICENSE (+20/-0) internal/github.com/gosexy/gettext/README.md (+94/-0) internal/github.com/gosexy/gettext/gettext.go (+207/-0) internal/github.com/gosexy/gettext/gettext_test.go (+130/-0) internal/vendor.json (+18/-10) |
To merge this branch: | bzr merge lp:~unity-api-team/unity-scope-snappy/add_gettext_to_vendors |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Kyle Fazzari (community) | Needs Fixing | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+269290@code.launchpad.net |
Commit message
Add github.
Description of the change
-
PS Jenkins bot (ps-jenkins) wrote : | # |
Kyle Fazzari (kyrofa) wrote : | # |
Add this to debian/copyright, as well. Another comment is in the diff.
- 35. By Antti Kaijanmäki
-
merge trunk, resolve conflict in internal/
vendor. json
Antti Kaijanmäki (kaijanmaki) wrote : | # |
OK, will modify debian/copyright.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:35
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 36. By Antti Kaijanmäki
-
update debian/copyright
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:36
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kyle Fazzari (kyrofa) wrote : | # |
A few more things that might need fixing here.
Unmerged revisions
- 36. By Antti Kaijanmäki
-
update debian/copyright
- 35. By Antti Kaijanmäki
-
merge trunk, resolve conflict in internal/
vendor. json - 34. By Antti Kaijanmäki
-
Add github.
com/gosexy/ gettext to vendors.
Preview Diff
1 | === modified file 'debian/copyright' | |||
2 | --- debian/copyright 2015-07-21 17:39:16 +0000 | |||
3 | +++ debian/copyright 2015-08-27 16:20:17 +0000 | |||
4 | @@ -54,6 +54,10 @@ | |||
5 | 54 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 54 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
6 | 55 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 55 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
7 | 56 | 56 | ||
8 | 57 | Files: internal/gihub.com/gosexy/gettext/* | ||
9 | 58 | Copyright: 2012-2013 José Carlos Nieto, http://xiam.menteslibres.org/ | ||
10 | 59 | License: MIT | ||
11 | 60 | |||
12 | 57 | Files: internal/golang.org/* | 61 | Files: internal/golang.org/* |
13 | 58 | Copyright: 2012 The Go Authors | 62 | Copyright: 2012 The Go Authors |
14 | 59 | License: BSD-3-clause | 63 | License: BSD-3-clause |
15 | 60 | 64 | ||
16 | === added directory 'internal/github.com/gosexy' | |||
17 | === added directory 'internal/github.com/gosexy/gettext' | |||
18 | === added file 'internal/github.com/gosexy/gettext/LICENSE' | |||
19 | --- internal/github.com/gosexy/gettext/LICENSE 1970-01-01 00:00:00 +0000 | |||
20 | +++ internal/github.com/gosexy/gettext/LICENSE 2015-08-27 16:20:17 +0000 | |||
21 | @@ -0,0 +1,20 @@ | |||
22 | 1 | Copyright (c) 2012-2013 José Carlos Nieto, http://xiam.menteslibres.org/ | ||
23 | 2 | |||
24 | 3 | Permission is hereby granted, free of charge, to any person obtaining | ||
25 | 4 | a copy of this software and associated documentation files (the | ||
26 | 5 | "Software"), to deal in the Software without restriction, including | ||
27 | 6 | without limitation the rights to use, copy, modify, merge, publish, | ||
28 | 7 | distribute, sublicense, and/or sell copies of the Software, and to | ||
29 | 8 | permit persons to whom the Software is furnished to do so, subject to | ||
30 | 9 | the following conditions: | ||
31 | 10 | |||
32 | 11 | The above copyright notice and this permission notice shall be | ||
33 | 12 | included in all copies or substantial portions of the Software. | ||
34 | 13 | |||
35 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
36 | 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
37 | 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
38 | 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
39 | 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
40 | 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
41 | 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
42 | 0 | 21 | ||
43 | === added file 'internal/github.com/gosexy/gettext/README.md' | |||
44 | --- internal/github.com/gosexy/gettext/README.md 1970-01-01 00:00:00 +0000 | |||
45 | +++ internal/github.com/gosexy/gettext/README.md 2015-08-27 16:20:17 +0000 | |||
46 | @@ -0,0 +1,94 @@ | |||
47 | 1 | # gosexy/gettext | ||
48 | 2 | |||
49 | 3 | Go bindings for [GNU gettext][1], an internationalization and localization | ||
50 | 4 | library for writing multilingual systems. | ||
51 | 5 | |||
52 | 6 | ## Requeriments | ||
53 | 7 | |||
54 | 8 | The GNU C library. If you're using GNU/Linux, FreeBSD or OSX you should already | ||
55 | 9 | have it. | ||
56 | 10 | |||
57 | 11 | ## Installation | ||
58 | 12 | |||
59 | 13 | Use `go get` to download and install the binding: | ||
60 | 14 | |||
61 | 15 | ```sh | ||
62 | 16 | go get github.com/gosexy/gettext | ||
63 | 17 | ``` | ||
64 | 18 | |||
65 | 19 | ## Usage | ||
66 | 20 | |||
67 | 21 | ```go | ||
68 | 22 | package main | ||
69 | 23 | |||
70 | 24 | import ( | ||
71 | 25 | "github.com/gosexy/gettext" | ||
72 | 26 | "fmt" | ||
73 | 27 | "os" | ||
74 | 28 | ) | ||
75 | 29 | |||
76 | 30 | func main() { | ||
77 | 31 | gettext.BindTextdomain("example", ".") | ||
78 | 32 | gettext.Textdomain("example") | ||
79 | 33 | |||
80 | 34 | os.Setenv("LANGUAGE", "es_MX.utf8") | ||
81 | 35 | |||
82 | 36 | gettext.SetLocale(gettext.LC_ALL, "") | ||
83 | 37 | |||
84 | 38 | fmt.Println(gettext.Gettext("Hello, world!")) | ||
85 | 39 | } | ||
86 | 40 | ``` | ||
87 | 41 | |||
88 | 42 | You can use `os.Setenv` to set the `LANGUAGE` environment variable or set it | ||
89 | 43 | on a terminal: | ||
90 | 44 | |||
91 | 45 | ```sh | ||
92 | 46 | export LANGUAGE="es_MX.utf8" | ||
93 | 47 | ./gettext-program | ||
94 | 48 | ``` | ||
95 | 49 | |||
96 | 50 | Note that `xgettext` does not officially support Go syntax yet, however, you | ||
97 | 51 | can generate a valid `.pot` file by forcing `xgettest` to use the C++ | ||
98 | 52 | syntax: | ||
99 | 53 | |||
100 | 54 | ```sh | ||
101 | 55 | xgettext -d example -s gettext_test.go -o example.pot -L c++ -i \ | ||
102 | 56 | --keyword=NGettext:1,2 --keyword=Gettext | ||
103 | 57 | ``` | ||
104 | 58 | |||
105 | 59 | This will generate a `example.pot` file. | ||
106 | 60 | |||
107 | 61 | After translating the `.pot` file, you must generate `.po` and `.mo` files and | ||
108 | 62 | remember to set the UTF-8 charset. | ||
109 | 63 | |||
110 | 64 | ```sh | ||
111 | 65 | msginit -l es_MX -o example.po -i example.pot | ||
112 | 66 | msgfmt -c -v -o example.mo example.po | ||
113 | 67 | ``` | ||
114 | 68 | |||
115 | 69 | Finally, move the `.mo` file to an appropriate location. | ||
116 | 70 | |||
117 | 71 | ```sh | ||
118 | 72 | mv example.mo examples/es_MX.utf8/LC_MESSAGES/example.mo | ||
119 | 73 | ``` | ||
120 | 74 | |||
121 | 75 | ## Documentation | ||
122 | 76 | |||
123 | 77 | You can read `gosexy/gettext` documentation from a terminal | ||
124 | 78 | |||
125 | 79 | ```sh | ||
126 | 80 | go doc github.com/gosexy/gettext | ||
127 | 81 | ``` | ||
128 | 82 | |||
129 | 83 | Or you can [browse it](http://godoc.org/github.com/gosexy/gettext) online. | ||
130 | 84 | |||
131 | 85 | The original gettext documentation could be very useful as well: | ||
132 | 86 | |||
133 | 87 | ```sh | ||
134 | 88 | man 3 gettext | ||
135 | 89 | ``` | ||
136 | 90 | |||
137 | 91 | Here's another [good tutorial][2] on using gettext. | ||
138 | 92 | |||
139 | 93 | [1]: http://www.gnu.org/software/gettext/ | ||
140 | 94 | [2]: http://oriya.sarovar.org/docs/gettext_single.html | ||
141 | 0 | 95 | ||
142 | === added file 'internal/github.com/gosexy/gettext/gettext.go' | |||
143 | --- internal/github.com/gosexy/gettext/gettext.go 1970-01-01 00:00:00 +0000 | |||
144 | +++ internal/github.com/gosexy/gettext/gettext.go 2015-08-27 16:20:17 +0000 | |||
145 | @@ -0,0 +1,207 @@ | |||
146 | 1 | /* | ||
147 | 2 | Copyright (c) 2012 José Carlos Nieto, http://xiam.menteslibres.org/ | ||
148 | 3 | |||
149 | 4 | Permission is hereby granted, free of charge, to any person obtaining | ||
150 | 5 | a copy of this software and associated documentation files (the | ||
151 | 6 | "Software"), to deal in the Software without restriction, including | ||
152 | 7 | without limitation the rights to use, copy, modify, merge, publish, | ||
153 | 8 | distribute, sublicense, and/or sell copies of the Software, and to | ||
154 | 9 | permit persons to whom the Software is furnished to do so, subject to | ||
155 | 10 | the following conditions: | ||
156 | 11 | |||
157 | 12 | The above copyright notice and this permission notice shall be | ||
158 | 13 | included in all copies or substantial portions of the Software. | ||
159 | 14 | |||
160 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
161 | 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
162 | 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
163 | 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
164 | 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
165 | 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
166 | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
167 | 22 | */ | ||
168 | 23 | |||
169 | 24 | package gettext | ||
170 | 25 | |||
171 | 26 | /* | ||
172 | 27 | |||
173 | 28 | #include <libintl.h> | ||
174 | 29 | #include <locale.h> | ||
175 | 30 | #include <stdlib.h> | ||
176 | 31 | */ | ||
177 | 32 | import "C" | ||
178 | 33 | |||
179 | 34 | import ( | ||
180 | 35 | "fmt" | ||
181 | 36 | "strings" | ||
182 | 37 | "unsafe" | ||
183 | 38 | ) | ||
184 | 39 | |||
185 | 40 | var ( | ||
186 | 41 | // For all of the locale. | ||
187 | 42 | LC_ALL = uint(C.LC_ALL) | ||
188 | 43 | |||
189 | 44 | // For regular expression matching (it determines the meaning of range | ||
190 | 45 | // expressions and equivalence classes) and string collation. | ||
191 | 46 | LC_COLATE = uint(C.LC_ALL) | ||
192 | 47 | |||
193 | 48 | // For regular expression matching, character classification, conversion, | ||
194 | 49 | // case-sensitive comparison, and wide character functions. | ||
195 | 50 | LC_CTYPE = uint(C.LC_CTYPE) | ||
196 | 51 | |||
197 | 52 | // For localizable natural-language messages. | ||
198 | 53 | LC_MESSAGES = uint(C.LC_MESSAGES) | ||
199 | 54 | |||
200 | 55 | // For monetary formatting. | ||
201 | 56 | LC_MONETARY = uint(C.LC_MONETARY) | ||
202 | 57 | |||
203 | 58 | // For number formatting (such as the decimal point and the thousands | ||
204 | 59 | // separator). | ||
205 | 60 | LC_NUMERIC = uint(C.LC_NUMERIC) | ||
206 | 61 | |||
207 | 62 | // For time and date formatting. | ||
208 | 63 | LC_TIME = uint(C.LC_TIME) | ||
209 | 64 | ) | ||
210 | 65 | |||
211 | 66 | // Sets or queries the program's current locale. | ||
212 | 67 | func SetLocale(category uint, locale string) string { | ||
213 | 68 | clocale := C.CString(locale) | ||
214 | 69 | |||
215 | 70 | res := C.GoString(C.setlocale(C.int(category), clocale)) | ||
216 | 71 | |||
217 | 72 | C.free(unsafe.Pointer(clocale)) | ||
218 | 73 | return res | ||
219 | 74 | } | ||
220 | 75 | |||
221 | 76 | // Sets directory containing message catalogs. | ||
222 | 77 | func BindTextdomain(domainname string, dirname string) string { | ||
223 | 78 | cdirname := C.CString(dirname) | ||
224 | 79 | cdomainname := C.CString(domainname) | ||
225 | 80 | |||
226 | 81 | res := C.GoString(C.bindtextdomain(cdomainname, cdirname)) | ||
227 | 82 | |||
228 | 83 | C.free(unsafe.Pointer(cdirname)) | ||
229 | 84 | C.free(unsafe.Pointer(cdomainname)) | ||
230 | 85 | return res | ||
231 | 86 | } | ||
232 | 87 | |||
233 | 88 | // Sets the output codeset for message catalogs for domain domainname. | ||
234 | 89 | func BindTextdomainCodeset(domainname string, codeset string) string { | ||
235 | 90 | cdomainname := C.CString(domainname) | ||
236 | 91 | ccodeset := C.CString(codeset) | ||
237 | 92 | |||
238 | 93 | res := C.GoString(C.bind_textdomain_codeset(cdomainname, ccodeset)) | ||
239 | 94 | |||
240 | 95 | C.free(unsafe.Pointer(cdomainname)) | ||
241 | 96 | C.free(unsafe.Pointer(ccodeset)) | ||
242 | 97 | return res | ||
243 | 98 | } | ||
244 | 99 | |||
245 | 100 | // Sets or retrieves the current message domain. | ||
246 | 101 | func Textdomain(domainname string) string { | ||
247 | 102 | cdomainname := C.CString(domainname) | ||
248 | 103 | |||
249 | 104 | res := C.GoString(C.textdomain(cdomainname)) | ||
250 | 105 | |||
251 | 106 | C.free(unsafe.Pointer(cdomainname)) | ||
252 | 107 | return res | ||
253 | 108 | } | ||
254 | 109 | |||
255 | 110 | // Attempt to translate a text string into the user's native language, by | ||
256 | 111 | // looking up the translation in a message catalog. | ||
257 | 112 | func Gettext(msgid string) string { | ||
258 | 113 | cmsgid := C.CString(msgid) | ||
259 | 114 | |||
260 | 115 | res := C.GoString(C.gettext(cmsgid)) | ||
261 | 116 | |||
262 | 117 | C.free(unsafe.Pointer(cmsgid)) | ||
263 | 118 | return res | ||
264 | 119 | } | ||
265 | 120 | |||
266 | 121 | // Like Gettext(), but looking up the message in the specified domain. | ||
267 | 122 | func DGettext(domain string, msgid string) string { | ||
268 | 123 | cdomain := C.CString(domain) | ||
269 | 124 | cmsgid := C.CString(msgid) | ||
270 | 125 | |||
271 | 126 | res := C.GoString(C.dgettext(cdomain, cmsgid)) | ||
272 | 127 | |||
273 | 128 | C.free(unsafe.Pointer(cdomain)) | ||
274 | 129 | C.free(unsafe.Pointer(cmsgid)) | ||
275 | 130 | return res | ||
276 | 131 | } | ||
277 | 132 | |||
278 | 133 | // Like Gettext(), but looking up the message in the specified domain and | ||
279 | 134 | // category. | ||
280 | 135 | func DCGettext(domain string, msgid string, category uint) string { | ||
281 | 136 | cdomain := C.CString(domain) | ||
282 | 137 | cmsgid := C.CString(msgid) | ||
283 | 138 | |||
284 | 139 | res := C.GoString(C.dcgettext(cdomain, cmsgid, C.int(category))) | ||
285 | 140 | |||
286 | 141 | C.free(unsafe.Pointer(cdomain)) | ||
287 | 142 | C.free(unsafe.Pointer(cmsgid)) | ||
288 | 143 | return res | ||
289 | 144 | } | ||
290 | 145 | |||
291 | 146 | // Attempt to translate a text string into the user's native language, by | ||
292 | 147 | // looking up the appropriate plural form of the translation in a message | ||
293 | 148 | // catalog. | ||
294 | 149 | func NGettext(msgid string, msgid_plural string, n uint64) string { | ||
295 | 150 | cmsgid := C.CString(msgid) | ||
296 | 151 | cmsgid_plural := C.CString(msgid_plural) | ||
297 | 152 | |||
298 | 153 | res := C.GoString(C.ngettext(cmsgid, cmsgid_plural, C.ulong(n))) | ||
299 | 154 | |||
300 | 155 | C.free(unsafe.Pointer(cmsgid)) | ||
301 | 156 | C.free(unsafe.Pointer(cmsgid_plural)) | ||
302 | 157 | |||
303 | 158 | return res | ||
304 | 159 | } | ||
305 | 160 | |||
306 | 161 | // Like fmt.Sprintf() but without %!(EXTRA) errors. | ||
307 | 162 | func Sprintf(format string, a ...interface{}) string { | ||
308 | 163 | expects := strings.Count(format, "%") - strings.Count(format, "%%") | ||
309 | 164 | |||
310 | 165 | if expects > 0 { | ||
311 | 166 | arguments := make([]interface{}, expects) | ||
312 | 167 | for i := 0; i < expects; i++ { | ||
313 | 168 | if len(a) > i { | ||
314 | 169 | arguments[i] = a[i] | ||
315 | 170 | } | ||
316 | 171 | } | ||
317 | 172 | return fmt.Sprintf(format, arguments...) | ||
318 | 173 | } | ||
319 | 174 | |||
320 | 175 | return format | ||
321 | 176 | } | ||
322 | 177 | |||
323 | 178 | // Like NGettext(), but looking up the message in the specified domain. | ||
324 | 179 | func DNGettext(domainname string, msgid string, msgid_plural string, n uint64) string { | ||
325 | 180 | cdomainname := C.CString(domainname) | ||
326 | 181 | cmsgid := C.CString(msgid) | ||
327 | 182 | cmsgid_plural := C.CString(msgid_plural) | ||
328 | 183 | |||
329 | 184 | res := C.GoString(C.dngettext(cdomainname, cmsgid, cmsgid_plural, C.ulong(n))) | ||
330 | 185 | |||
331 | 186 | C.free(unsafe.Pointer(cdomainname)) | ||
332 | 187 | C.free(unsafe.Pointer(cmsgid)) | ||
333 | 188 | C.free(unsafe.Pointer(cmsgid_plural)) | ||
334 | 189 | |||
335 | 190 | return res | ||
336 | 191 | } | ||
337 | 192 | |||
338 | 193 | // Like NGettext(), but looking up the message in the specified domain and | ||
339 | 194 | // category. | ||
340 | 195 | func DCNGettext(domainname string, msgid string, msgid_plural string, n uint64, category uint) string { | ||
341 | 196 | cdomainname := C.CString(domainname) | ||
342 | 197 | cmsgid := C.CString(msgid) | ||
343 | 198 | cmsgid_plural := C.CString(msgid_plural) | ||
344 | 199 | |||
345 | 200 | res := C.GoString(C.dcngettext(cdomainname, cmsgid, cmsgid_plural, C.ulong(n), C.int(category))) | ||
346 | 201 | |||
347 | 202 | C.free(unsafe.Pointer(cdomainname)) | ||
348 | 203 | C.free(unsafe.Pointer(cmsgid)) | ||
349 | 204 | C.free(unsafe.Pointer(cmsgid_plural)) | ||
350 | 205 | |||
351 | 206 | return res | ||
352 | 207 | } | ||
353 | 0 | 208 | ||
354 | === added file 'internal/github.com/gosexy/gettext/gettext_test.go' | |||
355 | --- internal/github.com/gosexy/gettext/gettext_test.go 1970-01-01 00:00:00 +0000 | |||
356 | +++ internal/github.com/gosexy/gettext/gettext_test.go 2015-08-27 16:20:17 +0000 | |||
357 | @@ -0,0 +1,130 @@ | |||
358 | 1 | package gettext | ||
359 | 2 | |||
360 | 3 | import ( | ||
361 | 4 | "fmt" | ||
362 | 5 | "os" | ||
363 | 6 | "testing" | ||
364 | 7 | ) | ||
365 | 8 | |||
366 | 9 | /* | ||
367 | 10 | NOTE: | ||
368 | 11 | |||
369 | 12 | xgettext does not officially support Go syntax, however, you can generate a valid .pot file by forcing | ||
370 | 13 | xgettest to use the C++ syntax: | ||
371 | 14 | |||
372 | 15 | % xgettext -d example -s gettext_test.go -o example.pot -L c++ -i --keyword=NGettext:1,2 --keyword=Gettext | ||
373 | 16 | |||
374 | 17 | This will generate a example.pot file. | ||
375 | 18 | |||
376 | 19 | After translating the .pot file, you must generate .po and .mo files. | ||
377 | 20 | |||
378 | 21 | Remember to set the UTF-8 charset. | ||
379 | 22 | |||
380 | 23 | % msginit -l es_MX -o example.po -i example.pot | ||
381 | 24 | % msgfmt -c -v -o example.mo example.po | ||
382 | 25 | |||
383 | 26 | And finally, move the .mo file to an appropriate location. | ||
384 | 27 | |||
385 | 28 | % mv example.mo examples/es_MX.utf8/LC_MESSAGES/example.mo | ||
386 | 29 | |||
387 | 30 | */ | ||
388 | 31 | |||
389 | 32 | func TestSpanishMexico(t *testing.T) { | ||
390 | 33 | |||
391 | 34 | os.Setenv("LANGUAGE", "es_MX.utf8") | ||
392 | 35 | |||
393 | 36 | SetLocale(LC_ALL, "") | ||
394 | 37 | BindTextdomain("example", "./examples/") | ||
395 | 38 | Textdomain("example") | ||
396 | 39 | |||
397 | 40 | t1 := Gettext("Hello, world!") | ||
398 | 41 | |||
399 | 42 | fmt.Println(t1) | ||
400 | 43 | |||
401 | 44 | if t1 != "¡Hola mundo!" { | ||
402 | 45 | t.Errorf("Failed translation.") | ||
403 | 46 | } | ||
404 | 47 | |||
405 | 48 | t2 := Sprintf(NGettext("An apple", "%d apples", 1), 1, "garbage") | ||
406 | 49 | |||
407 | 50 | fmt.Println(t2) | ||
408 | 51 | |||
409 | 52 | if t2 != "Una manzana" { | ||
410 | 53 | t.Errorf("Failed translation.") | ||
411 | 54 | } | ||
412 | 55 | |||
413 | 56 | t3 := Sprintf(NGettext("An apple", "%d apples", 3), 3) | ||
414 | 57 | |||
415 | 58 | fmt.Println(t3) | ||
416 | 59 | |||
417 | 60 | if t3 != "3 manzanas" { | ||
418 | 61 | t.Errorf("Failed translation.") | ||
419 | 62 | } | ||
420 | 63 | |||
421 | 64 | t4 := Gettext("Good morning") | ||
422 | 65 | |||
423 | 66 | fmt.Println(t4) | ||
424 | 67 | |||
425 | 68 | if t4 != "Buenos días" { | ||
426 | 69 | t.Errorf("Failed translation.") | ||
427 | 70 | } | ||
428 | 71 | |||
429 | 72 | t5 := Gettext("Good bye!") | ||
430 | 73 | |||
431 | 74 | fmt.Println(t5) | ||
432 | 75 | |||
433 | 76 | if t5 != "¡Hasta luego!" { | ||
434 | 77 | t.Errorf("Failed translation.") | ||
435 | 78 | } | ||
436 | 79 | |||
437 | 80 | } | ||
438 | 81 | |||
439 | 82 | func TestGermanDeutschland(t *testing.T) { | ||
440 | 83 | |||
441 | 84 | os.Setenv("LANGUAGE", "de_DE.utf8") | ||
442 | 85 | |||
443 | 86 | SetLocale(LC_ALL, "") | ||
444 | 87 | BindTextdomain("example", "./examples/") | ||
445 | 88 | Textdomain("example") | ||
446 | 89 | |||
447 | 90 | t1 := Gettext("Hello, world!") | ||
448 | 91 | |||
449 | 92 | fmt.Println(t1) | ||
450 | 93 | |||
451 | 94 | if t1 != "Hallo, Welt!" { | ||
452 | 95 | t.Errorf("Failed translation.") | ||
453 | 96 | } | ||
454 | 97 | |||
455 | 98 | t2 := Sprintf(NGettext("An apple", "%d apples", 1), 1, "garbage") | ||
456 | 99 | |||
457 | 100 | fmt.Println(t2) | ||
458 | 101 | |||
459 | 102 | if t2 != "Ein Apfel" { | ||
460 | 103 | t.Errorf("Failed translation.") | ||
461 | 104 | } | ||
462 | 105 | |||
463 | 106 | t3 := Sprintf(NGettext("An apple", "%d apples", 3), 3) | ||
464 | 107 | |||
465 | 108 | fmt.Println(t3) | ||
466 | 109 | |||
467 | 110 | if t3 != "3 Äpfel" { | ||
468 | 111 | t.Errorf("Failed translation.") | ||
469 | 112 | } | ||
470 | 113 | |||
471 | 114 | t4 := Gettext("Good morning") | ||
472 | 115 | |||
473 | 116 | fmt.Println(t4) | ||
474 | 117 | |||
475 | 118 | if t4 != "Guten morgen" { | ||
476 | 119 | t.Errorf("Failed translation.") | ||
477 | 120 | } | ||
478 | 121 | |||
479 | 122 | t5 := Gettext("Good bye!") | ||
480 | 123 | |||
481 | 124 | fmt.Println(t5) | ||
482 | 125 | |||
483 | 126 | if t5 != "Aufwiedersehen!" { | ||
484 | 127 | t.Errorf("Failed translation.") | ||
485 | 128 | } | ||
486 | 129 | |||
487 | 130 | } | ||
488 | 0 | 131 | ||
489 | === modified file 'internal/vendor.json' | |||
490 | --- internal/vendor.json 2015-07-30 14:22:57 +0000 | |||
491 | +++ internal/vendor.json 2015-08-27 16:20:17 +0000 | |||
492 | @@ -1,68 +1,76 @@ | |||
493 | 1 | { | 1 | { |
494 | 2 | "comment": "", | 2 | "comment": "", |
495 | 3 | "ignore": "", | ||
496 | 3 | "package": [ | 4 | "package": [ |
497 | 4 | { | 5 | { |
498 | 5 | "canonical": "github.com/AlekSi/gocov-xml", | 6 | "canonical": "github.com/AlekSi/gocov-xml", |
499 | 6 | "comment": "", | 7 | "comment": "", |
501 | 7 | "local": "launchpad.net/unity-scope-snappy/internal/github.com/AlekSi/gocov-xml", | 8 | "local": "github.com/AlekSi/gocov-xml", |
502 | 8 | "revision": "d2f6da892a0d5e0b587526abf51349ad654ade51", | 9 | "revision": "d2f6da892a0d5e0b587526abf51349ad654ade51", |
503 | 9 | "revisionTime": "2013-09-03T17:40:06+04:00" | 10 | "revisionTime": "2013-09-03T17:40:06+04:00" |
504 | 10 | }, | 11 | }, |
505 | 11 | { | 12 | { |
506 | 12 | "canonical": "github.com/axw/gocov", | 13 | "canonical": "github.com/axw/gocov", |
507 | 13 | "comment": "", | 14 | "comment": "", |
509 | 14 | "local": "launchpad.net/unity-scope-snappy/internal/github.com/axw/gocov", | 15 | "local": "github.com/axw/gocov", |
510 | 15 | "revision": "3b045e0eb61013ff134e6752184febc47d119f3a", | 16 | "revision": "3b045e0eb61013ff134e6752184febc47d119f3a", |
511 | 16 | "revisionTime": "2014-11-11T18:30:33+08:00" | 17 | "revisionTime": "2014-11-11T18:30:33+08:00" |
512 | 17 | }, | 18 | }, |
513 | 18 | { | 19 | { |
514 | 19 | "canonical": "github.com/axw/gocov/gocov", | 20 | "canonical": "github.com/axw/gocov/gocov", |
515 | 20 | "comment": "", | 21 | "comment": "", |
517 | 21 | "local": "launchpad.net/unity-scope-snappy/internal/github.com/axw/gocov/gocov", | 22 | "local": "github.com/axw/gocov/gocov", |
518 | 22 | "revision": "3b045e0eb61013ff134e6752184febc47d119f3a", | 23 | "revision": "3b045e0eb61013ff134e6752184febc47d119f3a", |
519 | 23 | "revisionTime": "2014-11-11T18:30:33+08:00" | 24 | "revisionTime": "2014-11-11T18:30:33+08:00" |
520 | 24 | }, | 25 | }, |
521 | 25 | { | 26 | { |
522 | 26 | "canonical": "github.com/axw/gocov/gocovutil", | 27 | "canonical": "github.com/axw/gocov/gocovutil", |
523 | 27 | "comment": "", | 28 | "comment": "", |
525 | 28 | "local": "launchpad.net/unity-scope-snappy/internal/github.com/axw/gocov/gocovutil", | 29 | "local": "github.com/axw/gocov/gocovutil", |
526 | 29 | "revision": "3b045e0eb61013ff134e6752184febc47d119f3a", | 30 | "revision": "3b045e0eb61013ff134e6752184febc47d119f3a", |
527 | 30 | "revisionTime": "2014-11-11T18:30:33+08:00" | 31 | "revisionTime": "2014-11-11T18:30:33+08:00" |
528 | 31 | }, | 32 | }, |
529 | 32 | { | 33 | { |
530 | 33 | "canonical": "github.com/dustin/go-humanize", | 34 | "canonical": "github.com/dustin/go-humanize", |
531 | 34 | "comment": "", | 35 | "comment": "", |
533 | 35 | "local": "launchpad.net/unity-scope-snappy/internal/github.com/dustin/go-humanize", | 36 | "local": "github.com/dustin/go-humanize", |
534 | 36 | "revision": "c128122e0b9b93799aef8181a537e5d8fd7081d6", | 37 | "revision": "c128122e0b9b93799aef8181a537e5d8fd7081d6", |
535 | 37 | "revisionTime": "2015-06-22T22:54:03-07:00" | 38 | "revisionTime": "2015-06-22T22:54:03-07:00" |
536 | 38 | }, | 39 | }, |
537 | 39 | { | 40 | { |
538 | 40 | "canonical": "github.com/godbus/dbus", | 41 | "canonical": "github.com/godbus/dbus", |
539 | 41 | "comment": "", | 42 | "comment": "", |
541 | 42 | "local": "launchpad.net/unity-scope-snappy/internal/github.com/godbus/dbus", | 43 | "local": "github.com/godbus/dbus", |
542 | 43 | "revision": "25c3068a42a0b50b877953fb249dbcffc6bd1bca", | 44 | "revision": "25c3068a42a0b50b877953fb249dbcffc6bd1bca", |
543 | 44 | "revisionTime": "2015-07-29T16:15:27-07:00" | 45 | "revisionTime": "2015-07-29T16:15:27-07:00" |
544 | 45 | }, | 46 | }, |
545 | 46 | { | 47 | { |
546 | 47 | "canonical": "github.com/godbus/dbus/introspect", | 48 | "canonical": "github.com/godbus/dbus/introspect", |
547 | 48 | "comment": "", | 49 | "comment": "", |
549 | 49 | "local": "launchpad.net/unity-scope-snappy/internal/github.com/godbus/dbus/introspect", | 50 | "local": "github.com/godbus/dbus/introspect", |
550 | 50 | "revision": "25c3068a42a0b50b877953fb249dbcffc6bd1bca", | 51 | "revision": "25c3068a42a0b50b877953fb249dbcffc6bd1bca", |
551 | 51 | "revisionTime": "2015-07-29T16:15:27-07:00" | 52 | "revisionTime": "2015-07-29T16:15:27-07:00" |
552 | 52 | }, | 53 | }, |
553 | 53 | { | 54 | { |
554 | 55 | "canonical": "github.com/gosexy/gettext", | ||
555 | 56 | "comment": "", | ||
556 | 57 | "local": "github.com/gosexy/gettext", | ||
557 | 58 | "revision": "98b7b91596d20b96909e6b60d57411547dd9959c", | ||
558 | 59 | "revisionTime": "2013-02-21T06:21:43-05:00" | ||
559 | 60 | }, | ||
560 | 61 | { | ||
561 | 54 | "canonical": "golang.org/x/tools/cover", | 62 | "canonical": "golang.org/x/tools/cover", |
562 | 55 | "comment": "", | 63 | "comment": "", |
564 | 56 | "local": "launchpad.net/unity-scope-snappy/internal/golang.org/x/tools/cover", | 64 | "local": "golang.org/x/tools/cover", |
565 | 57 | "revision": "af817890aa7b628234075a6cb01a3a435fb8317d", | 65 | "revision": "af817890aa7b628234075a6cb01a3a435fb8317d", |
566 | 58 | "revisionTime": "2015-06-17T17:25:35-07:00" | 66 | "revisionTime": "2015-06-17T17:25:35-07:00" |
567 | 59 | }, | 67 | }, |
568 | 60 | { | 68 | { |
569 | 61 | "canonical": "launchpad.net/go-unityscopes/v2", | 69 | "canonical": "launchpad.net/go-unityscopes/v2", |
570 | 62 | "comment": "", | 70 | "comment": "", |
572 | 63 | "local": "launchpad.net/unity-scope-snappy/internal/launchpad.net/go-unityscopes/v2", | 71 | "local": "launchpad.net/go-unityscopes/v2", |
573 | 64 | "revision": "69", | 72 | "revision": "69", |
574 | 65 | "revisionTime": "2015-06-02T10:39:20+02:00" | 73 | "revisionTime": "2015-06-02T10:39:20+02:00" |
575 | 66 | } | 74 | } |
576 | 67 | ] | 75 | ] |
577 | 68 | } | ||
578 | 69 | \ No newline at end of file | 76 | \ No newline at end of file |
579 | 77 | } |
FAILED: Continuous integration, rev:34 jenkins. qa.ubuntu. com/job/ unity-scope- snappy- ci/143/ jenkins. qa.ubuntu. com/job/ unity-scope- snappy- wily-amd64- ci/100/ console jenkins. qa.ubuntu. com/job/ unity-scope- snappy- wily-armhf- ci/97/console jenkins. qa.ubuntu. com/job/ unity-scope- snappy- wily-i386- ci/97/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- scope-snappy- ci/143/ rebuild
http://