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 | 43 | </p> | 43 | </p> |
6 | 44 | </form> | 44 | </form> |
7 | 45 | <div tal:condition="context/required:launchpad.Admin"> | 45 | <div tal:condition="context/required:launchpad.Admin"> |
9 | 46 | <a href="+add" class="add sprite">Add new language</a> | 46 | <a tal:attributes="href context/fmt:url/+add" |
10 | 47 | class="add sprite">Add new language</a> | ||
11 | 47 | </div> | 48 | </div> |
12 | 48 | </div> | 49 | </div> |
13 | 49 | </div> | 50 | </div> |
14 | @@ -66,16 +67,15 @@ | |||
15 | 66 | matching languages | 67 | matching languages |
16 | 67 | </h2> | 68 | </h2> |
17 | 68 | </tal:more> | 69 | </tal:more> |
19 | 69 | <dl condition="view/search_matches" class="languages"> | 70 | <ul condition="view/search_matches" class="languages"> |
20 | 70 | <tal:language repeat="language results"> | 71 | <tal:language repeat="language results"> |
22 | 71 | <dt> | 72 | <li> |
23 | 72 | <a tal:replace="structure language/fmt:link"> | 73 | <a tal:replace="structure language/fmt:link"> |
24 | 73 | Serbian (sr) | 74 | Serbian (sr) |
25 | 74 | </a> | 75 | </a> |
28 | 75 | </dt> | 76 | </li> |
27 | 76 | <dd></dd> | ||
29 | 77 | </tal:language> | 77 | </tal:language> |
31 | 78 | </dl> | 78 | </ul> |
32 | 79 | </tal:block> | 79 | </tal:block> |
33 | 80 | </div> | 80 | </div> |
34 | 81 | </div> | 81 | </div> |
35 | 82 | 82 |
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 | 170 | for item in pluralforms_list: | 170 | for item in pluralforms_list: |
6 | 171 | examples = ", ".join(map(str, item['examples'])) | 171 | examples = ", ".join(map(str, item['examples'])) |
7 | 172 | if len(item['examples']) != 1: | 172 | if len(item['examples']) != 1: |
9 | 173 | examples += ", ..." | 173 | examples += "..." |
10 | 174 | else: | 174 | else: |
11 | 175 | examples += "." | 175 | examples += "." |
12 | 176 | item['examples'] = examples | 176 | item['examples'] = examples |
13 | 177 | 177 | ||
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 | 13 | 13 | ||
19 | 14 | Following the link, there is a form to add new languages. | 14 | Following the link, there is a form to add new languages. |
20 | 15 | 15 | ||
22 | 16 | >>> admin_browser.getLink('Add Language').click() | 16 | >>> admin_browser.getLink('Add new language').click() |
23 | 17 | >>> print admin_browser.url | 17 | >>> print admin_browser.url |
24 | 18 | http://translations.launchpad.dev/+languages/+add | 18 | http://translations.launchpad.dev/+languages/+add |
25 | 19 | 19 | ||
26 | @@ -60,7 +60,7 @@ | |||
27 | 60 | >>> print user_browser.url | 60 | >>> print user_browser.url |
28 | 61 | http://translations.launchpad.dev/+languages | 61 | http://translations.launchpad.dev/+languages |
29 | 62 | 62 | ||
31 | 63 | >>> user_browser.getLink('Add Language') | 63 | >>> user_browser.getLink('Add new language') |
32 | 64 | Traceback (most recent call last): | 64 | Traceback (most recent call last): |
33 | 65 | ... | 65 | ... |
34 | 66 | LinkNotFoundError | 66 | LinkNotFoundError |
35 | @@ -78,14 +78,14 @@ | |||
36 | 78 | 78 | ||
37 | 79 | >>> text_search = browser.getControl(name='language_search') | 79 | >>> text_search = browser.getControl(name='language_search') |
38 | 80 | >>> text_search.value = 'Spanish' | 80 | >>> text_search.value = 'Spanish' |
40 | 81 | >>> browser.getControl('Search', index=0).click() | 81 | >>> browser.getControl('Find language', index=0).click() |
41 | 82 | >>> print browser.url | 82 | >>> print browser.url |
42 | 83 | http://translations.launchpad.dev/+languages/+index | 83 | http://translations.launchpad.dev/+languages/+index |
43 | 84 | 84 | ||
44 | 85 | And following one of the found languages, we can see a brief information | 85 | And following one of the found languages, we can see a brief information |
45 | 86 | about the selected language. | 86 | about the selected language. |
46 | 87 | 87 | ||
48 | 88 | >>> browser.getLink('Spanish (es)').click() | 88 | >>> browser.getLink('Spanish').click() |
49 | 89 | >>> print browser.url | 89 | >>> print browser.url |
50 | 90 | http://translations.launchpad.dev/+languages/es | 90 | http://translations.launchpad.dev/+languages/es |
51 | 91 | 91 | ||
52 | @@ -94,10 +94,9 @@ | |||
53 | 94 | Plural forms | 94 | Plural forms |
54 | 95 | Spanish has 2 plural forms: | 95 | Spanish has 2 plural forms: |
55 | 96 | Form 0 for 1. | 96 | Form 0 for 1. |
57 | 97 | Form 1 for 2, 3, 4, 5, 6, 7, ... | 97 | Form 1 for 2, 3, 4, 5, 6, 7... |
58 | 98 | When ... | 98 | When ... |
59 | 99 | 99 | ||
60 | 100 | |||
61 | 101 | >>> translationteams_portlet = find_portlet( | 100 | >>> translationteams_portlet = find_portlet( |
62 | 102 | ... browser.contents, 'Translation teams') | 101 | ... browser.contents, 'Translation teams') |
63 | 103 | >>> print translationteams_portlet | 102 | >>> print translationteams_portlet |
64 | 104 | 103 | ||
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 | 3 | xmlns:tal="http://xml.zope.org/namespaces/tal" | 3 | xmlns:tal="http://xml.zope.org/namespaces/tal" |
70 | 4 | xmlns:metal="http://xml.zope.org/namespaces/metal" | 4 | xmlns:metal="http://xml.zope.org/namespaces/metal" |
71 | 5 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" | 5 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" |
77 | 6 | xml:lang="en" | 6 | metal:use-macro="view/macro:page/main_only" |
73 | 7 | lang="en" | ||
74 | 8 | dir="ltr" | ||
75 | 9 | metal:use-macro="context/@@main_template/master" | ||
76 | 10 | i18n:domain="launchpad" | ||
78 | 11 | > | 7 | > |
79 | 12 | 8 | ||
80 | 13 | <body> | 9 | <body> |
81 | 14 | <metal:portlets fill-slot="portlets"> | ||
82 | 15 | </metal:portlets> | ||
83 | 16 | |||
84 | 17 | <div metal:fill-slot="main"> | 10 | <div metal:fill-slot="main"> |
85 | 18 | <h1>Languages in Launchpad</h1> | 11 | <h1>Languages in Launchpad</h1> |
90 | 19 | <form method="post"> | 12 | <div class="yui-b top-portlet"> |
91 | 20 | <table> | 13 | <p> |
92 | 21 | <tr> | 14 | Languages registered in Launchpad can be used for per-language |
93 | 22 | <th> | 15 | support with <a href="https://answers.launchpad.net">Answers</a>, |
94 | 16 | or for | ||
95 | 17 | <a href="https://translations.launchpad.net">Translations</a>. | ||
96 | 18 | <p> | ||
97 | 19 | <p> | ||
98 | 20 | If you can't find a language you are interested in, and you want | ||
99 | 21 | to add it to Launchpad for either Answers or Translations, please | ||
100 | 22 | follow | ||
101 | 23 | <a href="https://answers.launchpad.net/rosetta/+faq/23"> | ||
102 | 24 | How to create a new language | ||
103 | 25 | </a> | ||
104 | 26 | FAQ entry. | ||
105 | 27 | </p> | ||
106 | 28 | |||
107 | 29 | <div class="portlet"> | ||
108 | 30 | <h2>Find a language in Launchpad</h2> | ||
109 | 31 | <form method="post"> | ||
110 | 32 | <p> | ||
111 | 23 | <label for="language_search"> | 33 | <label for="language_search"> |
113 | 24 | Search Languages in Launchpad: | 34 | Language name/code contains: |
114 | 25 | </label> | 35 | </label> |
142 | 26 | </th> | 36 | <input |
143 | 27 | <td> | 37 | name="language_search" size="30" |
144 | 28 | <input | 38 | tal:attributes="value view/language_search" /> |
145 | 29 | name="language_search" size="30" | 39 | <input |
146 | 30 | tal:attributes="value view/language_search" /> | 40 | type="submit" |
147 | 31 | </td> | 41 | value="Find language" |
148 | 32 | </tr> | 42 | /> |
149 | 33 | <tr> | 43 | </p> |
150 | 34 | <td></td> | 44 | </form> |
151 | 35 | <td> | 45 | <div tal:condition="context/required:launchpad.Admin"> |
152 | 36 | <div class="actions"> | 46 | <a href="+add" class="add sprite">Add new language</a> |
153 | 37 | <input | 47 | </div> |
154 | 38 | tal:condition="view/search_requested" | 48 | </div> |
155 | 39 | type="submit" | 49 | </div> |
156 | 40 | value="Search Again" | 50 | <div tal:condition="view/search_requested" class="yui-b portlet"> |
130 | 41 | /> | ||
131 | 42 | <input | ||
132 | 43 | tal:condition="not: view/search_requested" | ||
133 | 44 | type="submit" | ||
134 | 45 | value="Search Languages" | ||
135 | 46 | /> | ||
136 | 47 | </div> | ||
137 | 48 | </td> | ||
138 | 49 | </tr> | ||
139 | 50 | </table> | ||
140 | 51 | </form> | ||
141 | 52 | <div tal:condition="view/search_requested"> | ||
157 | 53 | <tal:block tal:define="results view/search_results"> | 51 | <tal:block tal:define="results view/search_results"> |
201 | 54 | <table class="listing"> | 52 | <tal:none condition="not: view/search_matches"> |
202 | 55 | <thead> | 53 | <h2>No matching languages</h2> |
203 | 56 | <tr class="results"> | 54 | <p>No languages matching |
204 | 57 | <td colspan="0"> | 55 | “<span tal:replace="view/language_search"> |
205 | 58 | <span tal:replace="view/search_matches">3</span> | 56 | Foo |
206 | 59 | <span tal:condition="python: view.search_matches == 1"> | 57 | </span>” were found. |
207 | 60 | result | 58 | </p> |
208 | 61 | </span> | 59 | </tal:none> |
209 | 62 | <span tal:condition="python: view.search_matches != 1"> | 60 | <tal:one condition="python: view.search_matches == 1"> |
210 | 63 | results | 61 | <h2>One matching language</h2> |
211 | 64 | </span> | 62 | </tal:one> |
212 | 65 | </td> | 63 | <tal:more condition="python: view.search_matches > 1"> |
213 | 66 | </tr> | 64 | <h2> |
214 | 67 | </thead> | 65 | <tal:count replace="view/search_matches">3</tal:count> |
215 | 68 | <tbody> | 66 | matching languages |
216 | 69 | <tr> | 67 | </h2> |
217 | 70 | <td> | 68 | </tal:more> |
218 | 71 | <dl condition="view/search_matches" class="languages"> | 69 | <dl condition="view/search_matches" class="languages"> |
219 | 72 | <tal:block repeat="language results"> | 70 | <tal:language repeat="language results"> |
220 | 73 | <dt> | 71 | <dt> |
221 | 74 | <a tal:attributes="href language/code"> | 72 | <a tal:replace="structure language/fmt:link"> |
222 | 75 | <dfn tal:content="language/englishname"> | 73 | Serbian (sr) |
223 | 76 | $Language.englishname | 74 | </a> |
224 | 77 | </dfn> | 75 | </dt> |
225 | 78 | (<span tal:replace="language/code"> | 76 | <dd></dd> |
226 | 79 | $Language.code | 77 | </tal:language> |
227 | 80 | </span>) | 78 | </dl> |
185 | 81 | </a> | ||
186 | 82 | </dt> | ||
187 | 83 | <dd> | ||
188 | 84 | </dd> | ||
189 | 85 | </tal:block> | ||
190 | 86 | </dl> | ||
191 | 87 | <p tal:condition="not: view/search_matches"> | ||
192 | 88 | <strong>No Languages matching “ | ||
193 | 89 | <span tal:replace="view/language_search">Foo</span>” | ||
194 | 90 | were found. | ||
195 | 91 | </strong> | ||
196 | 92 | </p> | ||
197 | 93 | </td> | ||
198 | 94 | </tr> | ||
199 | 95 | </tbody> | ||
200 | 96 | </table> | ||
228 | 97 | </tal:block> | 79 | </tal:block> |
229 | 98 | </div> | 80 | </div> |
230 | 99 | </div> | 81 | </div> |
231 | 100 | 82 | ||
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 | 2 | xmlns="http://www.w3.org/1999/xhtml" | 2 | xmlns="http://www.w3.org/1999/xhtml" |
237 | 3 | xmlns:tal="http://xml.zope.org/namespaces/tal" | 3 | xmlns:tal="http://xml.zope.org/namespaces/tal" |
238 | 4 | xmlns:metal="http://xml.zope.org/namespaces/metal" | 4 | xmlns:metal="http://xml.zope.org/namespaces/metal" |
249 | 5 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" | 5 | metal:use-macro="view/macro:page/main_only" |
250 | 6 | xml:lang="en" | 6 | > |
241 | 7 | lang="en" | ||
242 | 8 | dir="ltr" | ||
243 | 9 | metal:use-macro="view/macro:page/onecolumn" | ||
244 | 10 | i18n:domain="launchpad" | ||
245 | 11 | ><!-- context/@@main_template/master | ||
246 | 12 | view/macro:page/onecolumn | ||
247 | 13 | --> | ||
248 | 14 | |||
251 | 15 | <body> | 7 | <body> |
252 | 16 | <div metal:fill-slot="head_epilogue"> | 8 | <div metal:fill-slot="head_epilogue"> |
253 | 17 | <style type="text/css"> | 9 | <style type="text/css"> |
254 | @@ -61,13 +53,6 @@ | |||
255 | 61 | </script> | 53 | </script> |
256 | 62 | </div> | 54 | </div> |
257 | 63 | <div metal:fill-slot="main"> | 55 | <div metal:fill-slot="main"> |
258 | 64 | <h1> | ||
259 | 65 | Translation templates for | ||
260 | 66 | <tal:title replace="context/title"> | ||
261 | 67 | evolution in Ubuntu Feisty | ||
262 | 68 | </tal:title> | ||
263 | 69 | </h1> | ||
264 | 70 | |||
265 | 71 | <ul class="helplinks"> | 56 | <ul class="helplinks"> |
266 | 72 | <li> | 57 | <li> |
267 | 73 | <a href="https://help.launchpad.net/Translations" | 58 | <a href="https://help.launchpad.net/Translations" |
268 | @@ -77,6 +62,21 @@ | |||
269 | 77 | </li> | 62 | </li> |
270 | 78 | </ul> | 63 | </ul> |
271 | 79 | 64 | ||
272 | 65 | <h1> | ||
273 | 66 | Translation templates for | ||
274 | 67 | <tal:title replace="context/title"> | ||
275 | 68 | evolution in Ubuntu Feisty | ||
276 | 69 | </tal:title> | ||
277 | 70 | </h1> | ||
278 | 71 | |||
279 | 72 | <div class="yui-b top-portlet"> | ||
280 | 73 | <p> | ||
281 | 74 | This is a listing of all the translatable templates | ||
282 | 75 | in <a tal:replace="structure context/fmt:link">here</a>. | ||
283 | 76 | </p> | ||
284 | 77 | </div> | ||
285 | 78 | |||
286 | 79 | <div class="yui-b"> | ||
287 | 80 | <table class="sortable listing" id="templates_table"> | 80 | <table class="sortable listing" id="templates_table"> |
288 | 81 | <thead> | 81 | <thead> |
289 | 82 | <tr> | 82 | <tr> |
290 | @@ -114,6 +114,7 @@ | |||
291 | 114 | </tr> | 114 | </tr> |
292 | 115 | </tbody> | 115 | </tbody> |
293 | 116 | </table> | 116 | </table> |
294 | 117 | </div> | ||
295 | 117 | </div> | 118 | </div> |
296 | 118 | </body> | 119 | </body> |
297 | 119 | </html> | 120 | </html> |
298 | 120 | 121 | ||
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 | 7 | make_friendly_plural_forms | 7 | make_friendly_plural_forms |
304 | 8 | -------------------------- | 8 | -------------------------- |
305 | 9 | 9 | ||
310 | 10 | The make_friendly_plural_forms method creates a list of dicts, each one containing a | 10 | The make_friendly_plural_forms method creates a list of dicts, each one |
311 | 11 | plural form number and a list of examples for this plural form. | 11 | containing a plural form number and a list of examples for this plural form. |
312 | 12 | It uses as input the plural forms expression for the language, C-like, and the number | 12 | It uses as input the plural forms expression for the language, C-like, and |
313 | 13 | of plural forms for the considered language. | 13 | the number of plural forms for the considered language. |
314 | 14 | 14 | ||
315 | 15 | >>> from lp.translations.utilities.pluralforms import ( | 15 | >>> from lp.translations.utilities.pluralforms import ( |
316 | 16 | ... make_friendly_plural_forms) | 16 | ... make_friendly_plural_forms) |
317 | 17 | 17 | ||
320 | 18 | 18 | Let's use a Serbian language as example. Here's the plural forms | |
321 | 19 | Let's use the serbian language as example. Here's the plural forms expression for serbian: | 19 | expression for Serbian: |
322 | 20 | 20 | ||
323 | 21 | >>> expression = 'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2' | 21 | >>> expression = 'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2' |
324 | 22 | 22 | ||
326 | 23 | It's also known that serbian has 3 plural forms. | 23 | It's also known that Serbian has 3 plural forms. |
327 | 24 | 24 | ||
328 | 25 | >>> pluralforms_count = 3 | 25 | >>> pluralforms_count = 3 |
329 | 26 | 26 | ||
330 | @@ -29,6 +29,6 @@ | |||
331 | 29 | 29 | ||
332 | 30 | >>> for form_dict in friendly_plural_forms: | 30 | >>> for form_dict in friendly_plural_forms: |
333 | 31 | ... print form_dict['form'], ":", form_dict['examples'] | 31 | ... print form_dict['form'], ":", form_dict['examples'] |
336 | 32 | 0 : [1] | 32 | 0 : [1, 21, 31, 41, 51, 61] |
337 | 33 | 1 : [2, 3, 4] | 33 | 1 : [2, 3, 4, 22, 23, 24] |
338 | 34 | 2 : [5, 6, 7, 8, 9, 10] | 34 | 2 : [5, 6, 7, 8, 9, 10] |
339 | 35 | 35 | ||
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 | 25 | forms.setdefault(form, []) | 25 | forms.setdefault(form, []) |
345 | 26 | # If all the plural forms for this language have examples (max. of 6 | 26 | # If all the plural forms for this language have examples (max. of 6 |
346 | 27 | # numbers per plural form), it stops. | 27 | # numbers per plural form), it stops. |
347 | 28 | if (len(forms[form]) == MAX_EXAMPLES and | ||
348 | 29 | len(forms) == pluralforms_count): | ||
349 | 30 | break | ||
350 | 31 | if len(forms[form]) == MAX_EXAMPLES: | 28 | if len(forms[form]) == MAX_EXAMPLES: |
351 | 32 | continue | 29 | continue |
352 | 33 | forms[form].append(number) | 30 | forms[form].append(number) |
353 | 34 | 31 |
= 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/