Merge lp://staging/~danilo/launchpad/remaining-templates into lp://staging/launchpad
- remaining-templates
- Merge into devel
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp://staging/~danilo/launchpad/remaining-templates |
Merge into: | lp://staging/launchpad |
Diff against target: | None lines |
To merge this branch: | bzr merge lp://staging/~danilo/launchpad/remaining-templates |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | code | Approve | |
Review via email:
|
Commit message
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Данило Шеган (danilo) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Gavin Panella (allenap) wrote : | # |
Hi Danilo,
Just a couple of minor comments.
Gavin.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -170,7 +170,7 @@
> for item in pluralforms_list:
> examples = ", ".join(map(str, item['examples']))
> if len(item[
> - examples += ", ..."
> + examples += "..."
> else:
> examples += "."
> item['examples'] = examples
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -22,8 +22,9 @@
> >>> print language_
> Edit Portuguese (Brazil) (pt_BR)
>
> -The view provides also a cancel_url and a next_url, but they're the same because
> -the previous and next steps of editing a language are returning to its index.
> +The view provides also a cancel_url and a next_url, but they're the same
> +because the previous and next steps of editing a language are returning
> +to its index.
>
> >>> print language_
> http://
> @@ -35,7 +36,7 @@
> Add Language
> ------------------
>
> - >>> language_add_view = create_
> + >>> language_add_view = create_
> ... layer=Translati
>
> >>> print language_
> @@ -50,7 +51,8 @@
> http://
>
> >>> print language_
> - ['code', 'englishname', 'nativename', 'pluralforms', 'pluralexpression', 'visible', 'direction']
> + ['code', 'englishname', 'nativename', 'pluralforms',
> + 'pluralexpression', 'visible', 'direction']
>
> >>> login("<email address hidden>")
> >>> form = {
> @@ -81,15 +83,16 @@
> >>> language_view = create_
> ... layer=Translati
>
> -The friendlypluralforms function shows us a list of plural forms and a set of examples
> -for each one, so one won't need to understand the plural formula expression to see how it works.
> +The friendlypluralforms function shows us a list of plural forms and
> +a set of examples for each one, so one won't need to understand the plural
> +formula expression to see how it works.
>
> >>> friendly_
>
> >>> for form_dict in friendly_
> ... print form_dict['form'], ':', form_dict[
> - 0 : 1.
> - 1 : 2, 3, 4, ...
> - 2 : 5, 6, 7, 8, 9, 10, ...
> + 0 : 1, 21, 31, 41, 51, 61...
> + 1 : 2, 3, 4, 22, 23, 24...
> + 2 : 5, 6, 7, 8, 9, 10...
>
>
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Данило Шеган (danilo) wrote : | # |
Heya, thanks again for the review.
У сре, 16. 09 2009. у 13:35 +0000, Gavin Panella пише:
>
> > === modified file 'lib/lp/
> > --- lib/lp/
> > +++ lib/lp/
...
> > + <div class="yui-b top-portlet">
> > + <p>
> > + Languages registered in Launchpad can be used for per-language
> > + support with <a href="https:/
>
> Argh, there has to be a better way to do this than hard-coding the
> link. Maybe not now, but we should have something like this.
>
> Off the top of my head, I imagine a global for doing traversals. Then
> we could do things like:
>
> find/answers/
>
> find/translatio
>
> find/answers/
>
> And so on.
I thought about this myself. However, the best I could come up with
would be dependent on sampledata having this FAQ (at least the number)
as well, and that sounded icky.
> Maybe this is already possible in a different way.
Well, I considered something like view methods providing a canonical_url
to the FAQ. I could have definitely used that for
canonical_
> Also, this is totally out of scope for this branch. Still, I'm
> interested if you know a way to avoid hard-coding those URLs.
Not really. The way we usually did that was to introduce a celebrity
for something, and then canonical_url that. I don't want to introduce a
celebrity for the FAQ entry. Perhaps we should have an editable
text_to_html snippet on the page where we could say something like FAQ
#23 and it would be automatically linkified (like bugs already are in
text-to-html formatter).
> > + <div tal:condition=
> > + <a href="+add" class="add sprite">Add new language</a>
>
> Could you use tal:attributes=
Certainly, done.
> > + <dl condition=
> > + <tal:language repeat="language results">
> > + <dt>
> > + <a tal:replace=
> > + Serbian (sr)
> > + </a>
> > + </dt>
> > + <dd></dd>
>
> Any reason to not use a <ul> here, as there is nothing in the <dd>?
Not really, changed.
Incremental diff attached.
Cheers,
Danilo
1 | === modified file 'lib/lp/translations/templates/languageset-index.pt' |
2 | --- lib/lp/translations/templates/languageset-index.pt 2009-09-16 03:56:44 +0000 |
3 | +++ lib/lp/translations/templates/languageset-index.pt 2009-09-16 14:30:57 +0000 |
4 | @@ -43,7 +43,8 @@ |
5 | </p> |
6 | </form> |
7 | <div tal:condition="context/required:launchpad.Admin"> |
8 | - <a href="+add" class="add sprite">Add new language</a> |
9 | + <a tal:attributes="href context/fmt:url/+add" |
10 | + class="add sprite">Add new language</a> |
11 | </div> |
12 | </div> |
13 | </div> |
14 | @@ -66,16 +67,15 @@ |
15 | matching languages |
16 | </h2> |
17 | </tal:more> |
18 | - <dl condition="view/search_matches" class="languages"> |
19 | + <ul condition="view/search_matches" class="languages"> |
20 | <tal:language repeat="language results"> |
21 | - <dt> |
22 | + <li> |
23 | <a tal:replace="structure language/fmt:link"> |
24 | Serbian (sr) |
25 | </a> |
26 | - </dt> |
27 | - <dd></dd> |
28 | + </li> |
29 | </tal:language> |
30 | - </dl> |
31 | + </ul> |
32 | </tal:block> |
33 | </div> |
34 | </div> |
35 |
Preview Diff
1 | === modified file 'lib/lp/translations/browser/language.py' |
2 | --- lib/lp/translations/browser/language.py 2009-09-10 13:31:25 +0000 |
3 | +++ lib/lp/translations/browser/language.py 2009-09-16 02:35:32 +0000 |
4 | @@ -170,7 +170,7 @@ |
5 | for item in pluralforms_list: |
6 | examples = ", ".join(map(str, item['examples'])) |
7 | if len(item['examples']) != 1: |
8 | - examples += ", ..." |
9 | + examples += "..." |
10 | else: |
11 | examples += "." |
12 | item['examples'] = examples |
13 | |
14 | === modified file 'lib/lp/translations/stories/standalone/xx-language.txt' |
15 | --- lib/lp/translations/stories/standalone/xx-language.txt 2009-09-14 15:18:41 +0000 |
16 | +++ lib/lp/translations/stories/standalone/xx-language.txt 2009-09-16 02:35:32 +0000 |
17 | @@ -13,7 +13,7 @@ |
18 | |
19 | Following the link, there is a form to add new languages. |
20 | |
21 | - >>> admin_browser.getLink('Add Language').click() |
22 | + >>> admin_browser.getLink('Add new language').click() |
23 | >>> print admin_browser.url |
24 | http://translations.launchpad.dev/+languages/+add |
25 | |
26 | @@ -60,7 +60,7 @@ |
27 | >>> print user_browser.url |
28 | http://translations.launchpad.dev/+languages |
29 | |
30 | - >>> user_browser.getLink('Add Language') |
31 | + >>> user_browser.getLink('Add new language') |
32 | Traceback (most recent call last): |
33 | ... |
34 | LinkNotFoundError |
35 | @@ -78,14 +78,14 @@ |
36 | |
37 | >>> text_search = browser.getControl(name='language_search') |
38 | >>> text_search.value = 'Spanish' |
39 | - >>> browser.getControl('Search', index=0).click() |
40 | + >>> browser.getControl('Find language', index=0).click() |
41 | >>> print browser.url |
42 | http://translations.launchpad.dev/+languages/+index |
43 | |
44 | And following one of the found languages, we can see a brief information |
45 | about the selected language. |
46 | |
47 | - >>> browser.getLink('Spanish (es)').click() |
48 | + >>> browser.getLink('Spanish').click() |
49 | >>> print browser.url |
50 | http://translations.launchpad.dev/+languages/es |
51 | |
52 | @@ -94,10 +94,9 @@ |
53 | Plural forms |
54 | Spanish has 2 plural forms: |
55 | Form 0 for 1. |
56 | - Form 1 for 2, 3, 4, 5, 6, 7, ... |
57 | + Form 1 for 2, 3, 4, 5, 6, 7... |
58 | When ... |
59 | |
60 | - |
61 | >>> translationteams_portlet = find_portlet( |
62 | ... browser.contents, 'Translation teams') |
63 | >>> print translationteams_portlet |
64 | |
65 | === modified file 'lib/lp/translations/templates/languageset-index.pt' |
66 | --- lib/lp/translations/templates/languageset-index.pt 2009-07-17 17:59:07 +0000 |
67 | +++ lib/lp/translations/templates/languageset-index.pt 2009-09-16 02:35:32 +0000 |
68 | @@ -3,97 +3,79 @@ |
69 | xmlns:tal="http://xml.zope.org/namespaces/tal" |
70 | xmlns:metal="http://xml.zope.org/namespaces/metal" |
71 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" |
72 | - xml:lang="en" |
73 | - lang="en" |
74 | - dir="ltr" |
75 | - metal:use-macro="context/@@main_template/master" |
76 | - i18n:domain="launchpad" |
77 | + metal:use-macro="view/macro:page/main_only" |
78 | > |
79 | |
80 | <body> |
81 | - <metal:portlets fill-slot="portlets"> |
82 | - </metal:portlets> |
83 | - |
84 | <div metal:fill-slot="main"> |
85 | <h1>Languages in Launchpad</h1> |
86 | - <form method="post"> |
87 | - <table> |
88 | - <tr> |
89 | - <th> |
90 | + <div class="yui-b top-portlet"> |
91 | + <p> |
92 | + Languages registered in Launchpad can be used for per-language |
93 | + support with <a href="https://answers.launchpad.net">Answers</a>, |
94 | + or for |
95 | + <a href="https://translations.launchpad.net">Translations</a>. |
96 | + <p> |
97 | + <p> |
98 | + If you can't find a language you are interested in, and you want |
99 | + to add it to Launchpad for either Answers or Translations, please |
100 | + follow |
101 | + <a href="https://answers.launchpad.net/rosetta/+faq/23"> |
102 | + How to create a new language |
103 | + </a> |
104 | + FAQ entry. |
105 | + </p> |
106 | + |
107 | + <div class="portlet"> |
108 | + <h2>Find a language in Launchpad</h2> |
109 | + <form method="post"> |
110 | + <p> |
111 | <label for="language_search"> |
112 | - Search Languages in Launchpad: |
113 | + Language name/code contains: |
114 | </label> |
115 | - </th> |
116 | - <td> |
117 | - <input |
118 | - name="language_search" size="30" |
119 | - tal:attributes="value view/language_search" /> |
120 | - </td> |
121 | - </tr> |
122 | - <tr> |
123 | - <td></td> |
124 | - <td> |
125 | - <div class="actions"> |
126 | - <input |
127 | - tal:condition="view/search_requested" |
128 | - type="submit" |
129 | - value="Search Again" |
130 | - /> |
131 | - <input |
132 | - tal:condition="not: view/search_requested" |
133 | - type="submit" |
134 | - value="Search Languages" |
135 | - /> |
136 | - </div> |
137 | - </td> |
138 | - </tr> |
139 | - </table> |
140 | - </form> |
141 | - <div tal:condition="view/search_requested"> |
142 | + <input |
143 | + name="language_search" size="30" |
144 | + tal:attributes="value view/language_search" /> |
145 | + <input |
146 | + type="submit" |
147 | + value="Find language" |
148 | + /> |
149 | + </p> |
150 | + </form> |
151 | + <div tal:condition="context/required:launchpad.Admin"> |
152 | + <a href="+add" class="add sprite">Add new language</a> |
153 | + </div> |
154 | + </div> |
155 | + </div> |
156 | + <div tal:condition="view/search_requested" class="yui-b portlet"> |
157 | <tal:block tal:define="results view/search_results"> |
158 | - <table class="listing"> |
159 | - <thead> |
160 | - <tr class="results"> |
161 | - <td colspan="0"> |
162 | - <span tal:replace="view/search_matches">3</span> |
163 | - <span tal:condition="python: view.search_matches == 1"> |
164 | - result |
165 | - </span> |
166 | - <span tal:condition="python: view.search_matches != 1"> |
167 | - results |
168 | - </span> |
169 | - </td> |
170 | - </tr> |
171 | - </thead> |
172 | - <tbody> |
173 | - <tr> |
174 | - <td> |
175 | - <dl condition="view/search_matches" class="languages"> |
176 | - <tal:block repeat="language results"> |
177 | - <dt> |
178 | - <a tal:attributes="href language/code"> |
179 | - <dfn tal:content="language/englishname"> |
180 | - $Language.englishname |
181 | - </dfn> |
182 | - (<span tal:replace="language/code"> |
183 | - $Language.code |
184 | - </span>) |
185 | - </a> |
186 | - </dt> |
187 | - <dd> |
188 | - </dd> |
189 | - </tal:block> |
190 | - </dl> |
191 | - <p tal:condition="not: view/search_matches"> |
192 | - <strong>No Languages matching “ |
193 | - <span tal:replace="view/language_search">Foo</span>” |
194 | - were found. |
195 | - </strong> |
196 | - </p> |
197 | - </td> |
198 | - </tr> |
199 | - </tbody> |
200 | - </table> |
201 | + <tal:none condition="not: view/search_matches"> |
202 | + <h2>No matching languages</h2> |
203 | + <p>No languages matching |
204 | + “<span tal:replace="view/language_search"> |
205 | + Foo |
206 | + </span>” were found. |
207 | + </p> |
208 | + </tal:none> |
209 | + <tal:one condition="python: view.search_matches == 1"> |
210 | + <h2>One matching language</h2> |
211 | + </tal:one> |
212 | + <tal:more condition="python: view.search_matches > 1"> |
213 | + <h2> |
214 | + <tal:count replace="view/search_matches">3</tal:count> |
215 | + matching languages |
216 | + </h2> |
217 | + </tal:more> |
218 | + <dl condition="view/search_matches" class="languages"> |
219 | + <tal:language repeat="language results"> |
220 | + <dt> |
221 | + <a tal:replace="structure language/fmt:link"> |
222 | + Serbian (sr) |
223 | + </a> |
224 | + </dt> |
225 | + <dd></dd> |
226 | + </tal:language> |
227 | + </dl> |
228 | </tal:block> |
229 | </div> |
230 | </div> |
231 | |
232 | === modified file 'lib/lp/translations/templates/object-templates.pt' |
233 | --- lib/lp/translations/templates/object-templates.pt 2009-07-17 17:59:07 +0000 |
234 | +++ lib/lp/translations/templates/object-templates.pt 2009-09-16 02:35:32 +0000 |
235 | @@ -2,16 +2,8 @@ |
236 | xmlns="http://www.w3.org/1999/xhtml" |
237 | xmlns:tal="http://xml.zope.org/namespaces/tal" |
238 | xmlns:metal="http://xml.zope.org/namespaces/metal" |
239 | - xmlns:i18n="http://xml.zope.org/namespaces/i18n" |
240 | - xml:lang="en" |
241 | - lang="en" |
242 | - dir="ltr" |
243 | - metal:use-macro="view/macro:page/onecolumn" |
244 | - i18n:domain="launchpad" |
245 | -><!-- context/@@main_template/master |
246 | - view/macro:page/onecolumn |
247 | - --> |
248 | - |
249 | + metal:use-macro="view/macro:page/main_only" |
250 | +> |
251 | <body> |
252 | <div metal:fill-slot="head_epilogue"> |
253 | <style type="text/css"> |
254 | @@ -61,13 +53,6 @@ |
255 | </script> |
256 | </div> |
257 | <div metal:fill-slot="main"> |
258 | - <h1> |
259 | - Translation templates for |
260 | - <tal:title replace="context/title"> |
261 | - evolution in Ubuntu Feisty |
262 | - </tal:title> |
263 | - </h1> |
264 | - |
265 | <ul class="helplinks"> |
266 | <li> |
267 | <a href="https://help.launchpad.net/Translations" |
268 | @@ -77,6 +62,21 @@ |
269 | </li> |
270 | </ul> |
271 | |
272 | + <h1> |
273 | + Translation templates for |
274 | + <tal:title replace="context/title"> |
275 | + evolution in Ubuntu Feisty |
276 | + </tal:title> |
277 | + </h1> |
278 | + |
279 | + <div class="yui-b top-portlet"> |
280 | + <p> |
281 | + This is a listing of all the translatable templates |
282 | + in <a tal:replace="structure context/fmt:link">here</a>. |
283 | + </p> |
284 | + </div> |
285 | + |
286 | + <div class="yui-b"> |
287 | <table class="sortable listing" id="templates_table"> |
288 | <thead> |
289 | <tr> |
290 | @@ -114,6 +114,7 @@ |
291 | </tr> |
292 | </tbody> |
293 | </table> |
294 | + </div> |
295 | </div> |
296 | </body> |
297 | </html> |
298 | |
299 | === modified file 'lib/lp/translations/utilities/doc/pluralforms.txt' |
300 | --- lib/lp/translations/utilities/doc/pluralforms.txt 2009-09-14 14:55:01 +0000 |
301 | +++ lib/lp/translations/utilities/doc/pluralforms.txt 2009-09-16 02:35:32 +0000 |
302 | @@ -7,20 +7,20 @@ |
303 | make_friendly_plural_forms |
304 | -------------------------- |
305 | |
306 | -The make_friendly_plural_forms method creates a list of dicts, each one containing a |
307 | -plural form number and a list of examples for this plural form. |
308 | -It uses as input the plural forms expression for the language, C-like, and the number |
309 | -of plural forms for the considered language. |
310 | +The make_friendly_plural_forms method creates a list of dicts, each one |
311 | +containing a plural form number and a list of examples for this plural form. |
312 | +It uses as input the plural forms expression for the language, C-like, and |
313 | +the number of plural forms for the considered language. |
314 | |
315 | >>> from lp.translations.utilities.pluralforms import ( |
316 | ... make_friendly_plural_forms) |
317 | |
318 | - |
319 | -Let's use the serbian language as example. Here's the plural forms expression for serbian: |
320 | +Let's use a Serbian language as example. Here's the plural forms |
321 | +expression for Serbian: |
322 | |
323 | >>> expression = 'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2' |
324 | |
325 | -It's also known that serbian has 3 plural forms. |
326 | +It's also known that Serbian has 3 plural forms. |
327 | |
328 | >>> pluralforms_count = 3 |
329 | |
330 | @@ -29,6 +29,6 @@ |
331 | |
332 | >>> for form_dict in friendly_plural_forms: |
333 | ... print form_dict['form'], ":", form_dict['examples'] |
334 | - 0 : [1] |
335 | - 1 : [2, 3, 4] |
336 | + 0 : [1, 21, 31, 41, 51, 61] |
337 | + 1 : [2, 3, 4, 22, 23, 24] |
338 | 2 : [5, 6, 7, 8, 9, 10] |
339 | |
340 | === modified file 'lib/lp/translations/utilities/pluralforms.py' |
341 | --- lib/lp/translations/utilities/pluralforms.py 2009-09-11 03:06:13 +0000 |
342 | +++ lib/lp/translations/utilities/pluralforms.py 2009-09-16 02:35:32 +0000 |
343 | @@ -25,9 +25,6 @@ |
344 | forms.setdefault(form, []) |
345 | # If all the plural forms for this language have examples (max. of 6 |
346 | # numbers per plural form), it stops. |
347 | - if (len(forms[form]) == MAX_EXAMPLES and |
348 | - len(forms) == pluralforms_count): |
349 | - break |
350 | if len(forms[form]) == MAX_EXAMPLES: |
351 | continue |
352 | forms[form].append(number) |
353 |
= Bug #430450 =
Migrate object-templates.pt and languagesets- index.pt to 3.0 layout:
simple mechanical changes.
Drive-by changes for plural forms rendering on language-index.pt page
(along with a test update).
= Demo & QA =
https:/ /translations. launchpad. dev/+languages /translations. launchpad. dev/evolution/ trunk/+ templates /translations. launchpad. dev/ubuntu/ hoary/+ templates
https:/
https:/
and for drive by cleanup
https:/ /translations. launchpad. dev/+languages/ sr
= Tests =
bin/test -vvt xx-language -t stories.*templates -t pluralforms
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: translations/ browser/ language. py translations/ stories/ standalone/ xx-language. txt translations/ templates/ languageset- index.pt translations/ templates/ object- templates. pt translations/ utilities/ pluralforms. py translations/ utilities/ doc/pluralforms .txt
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/