Merge lp:~danilo/launchpad/bug-423836-a into lp:~danilo/launchpad/bug-427264

Proposed by Данило Шеган
Status: Merged
Merge reported by: Данило Шеган
Merged at revision: not available
Proposed branch: lp:~danilo/launchpad/bug-423836-a
Merge into: lp:~danilo/launchpad/bug-427264
Diff against target: None lines
To merge this branch: bzr merge lp:~danilo/launchpad/bug-423836-a
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Данило Шеган Pending
Review via email: mp+11512@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

= Bug 423836: distroserieslanguage page =

(WARNING: Look at the attached diff in MP, not the full diff)

This branch migrates distroserieslanguage page to 3.0 layout. It's
split up from productserieslanguage migration (which reuses the same
template), so lint still has one error which will be fixed by a followup
branch.

It also introduces some global bits like a TranslationsLanguage
breadcrumb, which will be reused in the followup branch (i.e. it's
"global" instead of specific to DSL for a reason).

I also add missing tests for translation group breadcrumbs, which I
introduced earlier.

= Tests =

 bin/test -vvt 'translations.*breadcrumbs' -t stories.translations

(stories/translations/43-distrorelease-translations is the relevant page
test)

= Demo & QA =

 https://translations.launchpad.dev/ubuntu/hoary/+lang/es

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/pagetitles.py
  lib/canonical/launchpad/icing/style-3-0.css
  lib/lp/translations/configure.zcml
  lib/lp/translations/browser/configure.zcml
  lib/lp/translations/browser/distroserieslanguage.py
  lib/lp/translations/browser/translations.py
  lib/lp/translations/browser/tests/test_breadcrumbs.py
  lib/lp/translations/doc/canonical_url_examples.txt
  lib/lp/translations/model/distroserieslanguage.py
  lib/lp/translations/stories/standalone/xx-test-potlists.txt

lib/lp/translations/stories/translations/43-distrorelease-translations.txt
  lib/lp/translations/templates/serieslanguage-index.pt

== Pyflakes notices ==

lib/lp/translations/browser/tests/test_breadcrumbs.py
    16: 'IProductSeriesLanguageSet' imported but unused

== Pylint notices ==

lib/lp/translations/browser/tests/test_breadcrumbs.py
    16: [W0611] Unused import IProductSeriesLanguageSet

Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (16.3 KiB)

Wow - a huge amount of work has gone into this Danilo!

I've mainly got a few questions below, but there was one thing that needs fixing - a CSS rule that I think you meant to apply just to your table, but applies globally to all th's.

Phew! I'm glad you managed to split them up now - I don't think I could sensibly do another review today :)

Cheers,
-Michael

> === modified file 'lib/canonical/launchpad/icing/style-3-0.css'
> --- lib/canonical/launchpad/icing/style-3-0.css 2009-09-05 03:17:24 +0000
> +++ lib/canonical/launchpad/icing/style-3-0.css 2009-09-09 18:52:48 +0000
> @@ -748,6 +748,38 @@
> padding: 2px 1em 2px 2px;
> }
>
> +/* Translations statistics and legend.
> + *
> + * Examples:
> + * https://translations.launchpad.dev/ubuntu/hoary/+lang/es
> + * https://translations.launchpad.dev/evolution/trunk/+lang/es
> + */

Great to see examples in there as recommended the other week!

> +
> +div.translations-legend {
> + padding-top: 2em;
> + padding-bottom: 1em;
> +}

Note: although we didn't get to it in the reviewers meeting on 09/09/09,
I saw that barry had an agenda item:

* 4-space indents for CSS styles [barry]

Also, if that table can get large, and you want to do easy
alternate-row-shading, I just found the other day that you can do things like:

tbody.translation-stats tr:nth-child(odd) {...}

which works in FF3.5, webkit/chromium etc., without having to add markup.
See http://dev.opera.com/articles/view/zebra-striping-tables-with-css3/
if you're interested.

This CSS could possibly be much simpler if you put
the 'translation-stats' class on the table element (instead of on the
tbody). Then you could remove the overall-translation-stats class and do:

> +tbody.translation-stats td {

table.translation-stats td {...

(that way you don't need a separate rule for the tfoot below.)

> + text-align:center;
> +}
> +tbody.translation-stats td.template-name {

table.translation-stats td.template-name {...

(no difference there).

> + text-align:left;
> +}
> +tfoot tr.overall-translation-stats td, th {

Yikes - careful there. This actually reads currently as:

"Apply the following styles to any td's inside a tr...etc., or *any* th."

So, for example, you can see this is being applied to th's at:

https://launchpad.dev/builders

Anyway, if you updated the class as suggested above, you could write it
as:
table.translation-stats tfoot td, table.translation-stats tfoot th {...

> + background-color: #f7f7f7;
> + border: 0px;
> + border-top: 2px solid #d2d2d2;
> + border-bottom: 2px solid #d2d2d2;
> + padding-top: 5px;
> + padding-bottom: 5px;
> + font-weight: bold;
> +}
> +tfoot tr.overall-translation-stats th {

table.translation-stats tfoot th { ...

> + text-align:left;
> +}
> +tfoot tr.overall-translation-stats td {

table.translation-stats tfoot td { ...

> + text-align:center;
> +}
> table.narrow-listing {
> width: 45em;
> }
>

[snip]
> === modified file 'lib/lp/translations/browser/distroserieslanguage.py'
> --- lib/lp/translations/browser/distroserieslanguage.py 2009-07-17 00:26:05 +0000
> +++ lib/lp/translations/browser/distroserieslanguage.py 2009-09-10 09:45:00 +0000
> @@ -5,17 +5,26 @@
>
> __meta...

review: Needs Fixing (code)
Revision history for this message
Данило Шеган (danilo) wrote :
Download full text (9.8 KiB)

Hi Michael,

Thanks a lot for the review. Comments inline.

У чет, 10. 09 2009. у 14:44 +0000, Michael Nelson пише:

> I've mainly got a few questions below, but there was one thing that
> needs fixing - a CSS rule that I think you meant to apply just to your
> table, but applies globally to all th's.

Indeed, this is something I forgot to fix up from the 'prototyping'
phase.

> > === modified file 'lib/canonical/launchpad/icing/style-3-0.css'
> > --- lib/canonical/launchpad/icing/style-3-0.css 2009-09-05 03:17:24 +0000
> > +++ lib/canonical/launchpad/icing/style-3-0.css 2009-09-09 18:52:48 +0000
...
> > +
> > +div.translations-legend {
> > + padding-top: 2em;
> > + padding-bottom: 1em;
> > +}
>
> Note: although we didn't get to it in the reviewers meeting on 09/09/09,
> I saw that barry had an agenda item:
>
> * 4-space indents for CSS styles [barry]

Fixed.

> Also, if that table can get large, and you want to do easy
> alternate-row-shading, I just found the other day that you can do things like:
>
> tbody.translation-stats tr:nth-child(odd) {...}

Oh, I know about that CSS3 feature. However, considering my main
browser is Epiphany which still uses xulrunner 1.9 (I believe shared
with Firefox 2 or 3), I am not personally interested :)

Just kidding, I am not going to change styles on existing table too
much, if at all. I am trying to make this mostly mechanical.

> This CSS could possibly be much simpler if you put
> the 'translation-stats' class on the table element (instead of on the
> tbody). Then you could remove the overall-translation-stats class and do:

That's actually what I started with. However, fighting legacy CSS code
is hell. 'table.listing tbody td' takes precedence over
'table.translation-stats tbody td'. I am not yet ready to do away with
class='listing' on these tables, though, simply because I am not trying
to solve all the problems with these pages. It's mostly mechanical
changes, and no real redesign.

> > +tbody.translation-stats td {
>
> table.translation-stats td {...
>
> (that way you don't need a separate rule for the tfoot below.)

Actually, the 'cascading' of CSS seems to cause me problems in at least
Epiphany (xulrunner 1.9): if I set the rule up like that (that's what I
started with), it doesn't get picked up. I'll play a bit more with CSS
and will follow up.

It's good to know that even CSS precedence rules differ between
browsers. :(

> > +tfoot tr.overall-translation-stats td, th {
>
> Yikes - careful there. This actually reads currently as:
>
> "Apply the following styles to any td's inside a tr...etc., or *any* th."
>
> So, for example, you can see this is being applied to th's at:
>
> https://launchpad.dev/builders

Right, fixed.

> > === modified file 'lib/lp/translations/browser/distroserieslanguage.py'
...
> >
> > + @property
> > + def page_title(self):
> > + return self.context.title
> > +
>
> Just note that you will probably need to remove this soon - when barry's
> branch lands that calculates the <title> automatically. It should only
> be overridden here in special cases (yes, this changed... see the points
> under "Here are the specific coding recommendations fo...

1=== modified file 'lib/canonical/launchpad/icing/style-3-0.css'
2--- lib/canonical/launchpad/icing/style-3-0.css 2009-09-09 18:52:48 +0000
3+++ lib/canonical/launchpad/icing/style-3-0.css 2009-09-11 06:26:18 +0000
4@@ -695,32 +695,32 @@
5 /* ==== Translations hand-made forms ==== */
6
7 form.translations div.fields {
8- padding: 1em;
9+ padding: 1em;
10 }
11
12 form.translations div.actions {
13- padding: 1em;
14- text-align: right;
15- clear:both;
16+ padding: 1em;
17+ text-align: right;
18+ clear:both;
19 }
20
21 form.translations input {
22- padding-left: 0.5em;
23- padding-right: 0.5em;
24+ padding-left: 0.5em;
25+ padding-right: 0.5em;
26 }
27
28 form.translations select {
29- margin-left: 0.5em;
30- padding-right: 0.5em;
31+ margin-left: 0.5em;
32+ padding-right: 0.5em;
33 }
34
35 form.translations label {
36- padding-left: 0.5em;
37- padding-right: 1em;
38+ padding-left: 0.5em;
39+ padding-right: 1em;
40 }
41
42 form.translations .listbox label {
43- padding: 2px 1em 2px 2px;
44+ padding: 2px 1em 2px 2px;
45 }
46
47 /* Provide top-alignment for radio boxes and longer explanations
48@@ -731,21 +731,21 @@
49 * https://translations.launchpad.dev/evolution/trunk/+pots/evolution-2.2/+export
50 */
51 form.translations div.alignment .content {
52- float:left;
53+ float:left;
54 }
55 form.translations div.alignment .selector {
56- margin-right: 0.5em;
57- float: left;
58- clear: both;
59+ margin-right: 0.5em;
60+ float: left;
61+ clear: both;
62 }
63 form.translations div.alignment .content label {
64- padding: 0px;
65- margin: 0px;
66- font-weight: bold;
67+ padding: 0px;
68+ margin: 0px;
69+ font-weight: bold;
70 }
71 form.translations div.alignment .secondary label {
72- font-weight: normal;
73- padding: 2px 1em 2px 2px;
74+ font-weight: normal;
75+ padding: 2px 1em 2px 2px;
76 }
77
78 /* Translations statistics and legend.
79@@ -756,30 +756,31 @@
80 */
81
82 div.translations-legend {
83- padding-top: 2em;
84- padding-bottom: 1em;
85+ padding-top: 2em;
86+ padding-bottom: 1em;
87 }
88 tbody.translation-stats td {
89- text-align:center;
90+ text-align:center;
91 }
92 tbody.translation-stats td.template-name {
93- text-align:left;
94-}
95-tfoot tr.overall-translation-stats td, th {
96- background-color: #f7f7f7;
97- border: 0px;
98- border-top: 2px solid #d2d2d2;
99- border-bottom: 2px solid #d2d2d2;
100- padding-top: 5px;
101- padding-bottom: 5px;
102- font-weight: bold;
103-}
104-tfoot tr.overall-translation-stats th {
105- text-align:left;
106+ text-align:left;
107+}
108+tfoot tr.overall-translation-stats td,
109+tfoot tr.overall-translation-stats th {
110+ background-color: #f7f7f7;
111+ border: 0px;
112+ border-top: 2px solid #d2d2d2;
113+ border-bottom: 2px solid #d2d2d2;
114+ padding-top: 5px;
115+ padding-bottom: 5px;
116+ font-weight: bold;
117+}
118+tfoot tr.overall-translation-stats th {
119+ text-align:left;
120 }
121 tfoot tr.overall-translation-stats td {
122- text-align:center;
123+ text-align:center;
124 }
125 table.narrow-listing {
126- width: 45em;
127+ width: 45em;
128 }
129
130=== added file 'lib/lp/translations/browser/tests/test_distroserieslanguage_views.py'
131--- lib/lp/translations/browser/tests/test_distroserieslanguage_views.py 1970-01-01 00:00:00 +0000
132+++ lib/lp/translations/browser/tests/test_distroserieslanguage_views.py 2009-09-11 06:42:33 +0000
133@@ -0,0 +1,72 @@
134+# Copyright 2009 Canonical Ltd. This software is licensed under the
135+# GNU Affero General Public License version 3 (see the file LICENSE).
136+
137+__metaclass__ = type
138+
139+import transaction
140+import unittest
141+
142+from zope.component import getUtility
143+
144+from lp.translations.browser.distroserieslanguage import (
145+ DistroSeriesLanguageView)
146+from lp.translations.interfaces.translator import ITranslatorSet
147+from canonical.launchpad.webapp.servers import LaunchpadTestRequest
148+from canonical.testing import LaunchpadZopelessLayer
149+from lp.translations.browser.distroseries import DistroSeriesView
150+from lp.services.worlddata.interfaces.language import ILanguageSet
151+from lp.testing import TestCaseWithFactory, login_person
152+
153+
154+class TestDistroSeriesLanguage(TestCaseWithFactory):
155+ """Test DistroSeriesLanguage view."""
156+
157+ layer = LaunchpadZopelessLayer
158+
159+ def setUp(self):
160+ # Create a distroseries that uses translations.
161+ TestCaseWithFactory.setUp(self)
162+ self.distroseries = self.factory.makeDistroRelease()
163+ self.distroseries.distribution.official_rosetta = True
164+ self.language = getUtility(ILanguageSet).getLanguageByCode('sr')
165+ sourcepackagename = self.factory.makeSourcePackageName()
166+ potemplate = self.factory.makePOTemplate(
167+ distroseries=self.distroseries,
168+ sourcepackagename=sourcepackagename)
169+ pofile = self.factory.makePOFile('sr', potemplate)
170+ self.distroseries.updateStatistics(transaction)
171+ self.dsl = self.distroseries.distroserieslanguages[0]
172+ self.view = DistroSeriesLanguageView(
173+ self.dsl, LaunchpadTestRequest())
174+
175+ def test_empty_view(self):
176+ self.assertEquals(self.view.translation_group, None)
177+ self.assertEquals(self.view.translation_team, None)
178+ self.assertEquals(self.view.context, self.dsl)
179+
180+ def test_translation_group(self):
181+ group = self.factory.makeTranslationGroup(
182+ self.distroseries.distribution.owner, url=None)
183+ self.distroseries.distribution.translationgroup = group
184+ self.assertEquals(self.view.translation_group, group)
185+
186+ def test_translation_team(self):
187+ # Just having a group doesn't mean there's a translation
188+ # team as well.
189+ group = self.factory.makeTranslationGroup(
190+ self.distroseries.distribution.owner, url=None)
191+ self.distroseries.distribution.translationgroup = group
192+ self.assertEquals(self.view.translation_team, None)
193+
194+ # Setting a translator for this languages makes it
195+ # appear as the translation_team.
196+ team = self.factory.makeTeam()
197+ translator = getUtility(ITranslatorSet).new(
198+ group, self.language, team)
199+ # Recreate the view because we are using a cached property.
200+ self.view = DistroSeriesLanguageView(
201+ self.dsl, LaunchpadTestRequest())
202+ self.assertEquals(self.view.translation_team, translator)
203+
204+def test_suite():
205+ return unittest.TestLoader().loadTestsFromName(__name__)
206
207=== modified file 'lib/lp/translations/doc/distroseries-language.txt'
208--- lib/lp/translations/doc/distroseries-language.txt 2009-07-14 12:37:42 +0000
209+++ lib/lp/translations/doc/distroseries-language.txt 2009-09-11 06:46:22 +0000
210@@ -19,6 +19,11 @@
211 >>> spanish = getUtility(ILanguageSet)['es']
212 >>> hoary_spanish = hoary.getDistroSeriesLanguage(spanish)
213
214+DistroSeriesLanguage provides basic `title` describing what is it about.
215+
216+ >>> hoary_spanish.title
217+ Spanish translations of Ubuntu Hoary
218+
219 In DistroSeriesLanguage.pofiles we find real POFiles for the given
220 DistroSeries in the given language. That is, translations that actually
221 contain messages.
222
223=== modified file 'lib/lp/translations/model/distroserieslanguage.py'
224--- lib/lp/translations/model/distroserieslanguage.py 2009-09-09 11:57:25 +0000
225+++ lib/lp/translations/model/distroserieslanguage.py 2009-09-11 06:45:34 +0000
226@@ -58,10 +58,6 @@
227 self.distroseries.displayname)
228
229 @property
230- def text(self):
231- return self.language.englishname
232-
233- @property
234 def pofiles(self):
235 return POFile.select('''
236 POFile.language = %s AND
237
Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (10.0 KiB)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Данило Шеган wrote:
> Hi Michael,
>
> Thanks a lot for the review. Comments inline.
>

Thanks for the changes! r=me - some comments below.

Cheers,
Michael.

>
>> This CSS could possibly be much simpler if you put
>> the 'translation-stats' class on the table element (instead of on the
>> tbody). Then you could remove the overall-translation-stats class and do:
>
> That's actually what I started with. However, fighting legacy CSS code
> is hell. 'table.listing tbody td' takes precedence over
> 'table.translation-stats tbody td'. I am not yet ready to do away with
> class='listing' on these tables, though, simply because I am not trying
> to solve all the problems with these pages. It's mostly mechanical
> changes, and no real redesign.

OK. It's up to you, but I'm guessing:

table.listing.translation-stats tbody td {...}

would take precedence (ie. selecting both classes - as it's more
specific). I'm not fussed either way - what you've got works, and it's
not a huge improvement to remove one class.

>
>>> +tbody.translation-stats td {
>> table.translation-stats td {...
>>
>> (that way you don't need a separate rule for the tfoot below.)
>
> Actually, the 'cascading' of CSS seems to cause me problems in at least
> Epiphany (xulrunner 1.9): if I set the rule up like that (that's what I
> started with), it doesn't get picked up. I'll play a bit more with CSS
> and will follow up.
>
> It's good to know that even CSS precedence rules differ between
> browsers. :(

Really? That is very strange. Try the more specific one I mentioned
above - selecting both classes - I'd be interested to know why it was
been over-ruled... is there something like firebug for epiphany?

>
>>> +tfoot tr.overall-translation-stats td, th {
>> Yikes - careful there. This actually reads currently as:
>>
>> "Apply the following styles to any td's inside a tr...etc., or *any* th."
>>
>> So, for example, you can see this is being applied to th's at:
>>
>> https://launchpad.dev/builders
>
> Right, fixed.

Great.

>
>>> === modified file 'lib/lp/translations/browser/distroserieslanguage.py'
> ...
>>>
>>> + @property
>>> + def page_title(self):
>>> + return self.context.title
>>> +
>> Just note that you will probably need to remove this soon - when barry's
>> branch lands that calculates the <title> automatically. It should only
>> be overridden here in special cases (yes, this changed... see the points
>> under "Here are the specific coding recommendations for your templates"
>> at: https://dev.launchpad.net/VersionThreeDotO/UI/Conversion#Heading%20rules
>
> At the moment, I either can't remove it from pagetitles.py or I have to
> define it like this. And yes, I am completely aware of the work Barry's
> doing, and I am completely aware that I'll have to go through all the
> translations pages to make sure that breadcrumbs, page titles, h2's and
> h1's make sense on them. And that's exactly what I was planning to do
> anyway.

Well *sorrrry* - I'd forgotten it was you helping barry with the rules -
 in previous reviews people haven't been aware. Next time I'll just keep
my mouth shut ;)

>
>>> @@ -25...

Revision history for this message
Michael Nelson (michael.nelson) :
review: Approve (code)
Revision history for this message
Данило Шеган (danilo) wrote :
Download full text (3.5 KiB)

У пет, 11. 09 2009. у 07:18 +0000, Michael Nelson пише:

> >> This CSS could possibly be much simpler if you put
> >> the 'translation-stats' class on the table element (instead of on the
> >> tbody). Then you could remove the overall-translation-stats class and do:
> >
> > That's actually what I started with. However, fighting legacy CSS code
> > is hell. 'table.listing tbody td' takes precedence over
> > 'table.translation-stats tbody td'. I am not yet ready to do away with
> > class='listing' on these tables, though, simply because I am not trying
> > to solve all the problems with these pages. It's mostly mechanical
> > changes, and no real redesign.
>
> OK. It's up to you, but I'm guessing:
>
> table.listing.translation-stats tbody td {...}

> would take precedence (ie. selecting both classes - as it's more
> specific). I'm not fussed either way - what you've got works, and it's
> not a huge improvement to remove one class.

Actually, it seems the problem was the 'tr' I had in when I tried this.
It "suddenly" just works.

Btw, I wouldn't think of combining classes like this, so thanks for the
pointer: I am sure it'll be useful in the future, but the simpler stuff
works here :)

> >>> +tbody.translation-stats td {
> >> table.translation-stats td {...
> >>
> >> (that way you don't need a separate rule for the tfoot below.)
> >
> > Actually, the 'cascading' of CSS seems to cause me problems in at least
> > Epiphany (xulrunner 1.9): if I set the rule up like that (that's what I
> > started with), it doesn't get picked up. I'll play a bit more with CSS
> > and will follow up.
> >
> > It's good to know that even CSS precedence rules differ between
> > browsers. :(
>
> Really? That is very strange. Try the more specific one I mentioned
> above - selecting both classes - I'd be interested to know why it was
> been over-ruled... is there something like firebug for epiphany?

Oh, it seems they don't differ: I was using a CSS rule with 'tr' in it
as well, and that probably caused problems. With that removed, it works
in Epiphany as well.

Also, I was under the impression that you tried this out in Firefox 3.5:
I did try this out in whatever-firefox-is-in-jaunty with firebug (which
is how I've seen that it doesn't really work properly). There is not
yet anything like firebug for epiphany, so in hard cases, I resort to
firefox :)

> Well *sorrrry* - I'd forgotten it was you helping barry with the rules -
> in previous reviews people haven't been aware. Next time I'll just keep
> my mouth shut ;)

Not at all! I think you should keep mentioning it: it's important that
everybody is aware of it.

> > Perhaps it'd make some sense for me to provide Navigation class for
> > ITranslationGroupSet, just so it's more consistent and so no confusion
> > arises in the future. Or perhaps just comment that this doesn't show up
> > in the request.traversed_objects because it doesn't provide Navigation
> > class.
> >
> > What do you think?
>
> I think a comment would be fine - it would have cleared up my confusion.

Done.

> No problem - I hope you didn't feel patronized by me pointing out things
> that were already obvious to you.

Don't worry at a...

Read more...

1=== modified file 'lib/canonical/launchpad/icing/style-3-0.css'
2--- lib/canonical/launchpad/icing/style-3-0.css 2009-09-11 06:57:21 +0000
3+++ lib/canonical/launchpad/icing/style-3-0.css 2009-09-11 08:20:21 +0000
4@@ -685,6 +685,9 @@ table.listing thead {
5 table.listing th {
6 font-weight: bold;
7 }
8+table.narrow-listing {
9+ width: 45em;
10+}
11
12 ul.language, li.language {
13 list-style-image: url(/@@/language);
14@@ -759,14 +762,14 @@ div.translations-legend {
15 padding-top: 2em;
16 padding-bottom: 1em;
17 }
18-tbody.translation-stats td {
19+table.translation-stats td {
20 text-align:center;
21 }
22-tbody.translation-stats td.template-name {
23+table.translation-stats td.template-name {
24 text-align:left;
25 }
26-tfoot tr.overall-translation-stats td,
27-tfoot tr.overall-translation-stats th {
28+table.translation-stats tfoot td,
29+table.translation-stats tfoot th {
30 background-color: #f7f7f7;
31 border: 0px;
32 border-top: 2px solid #d2d2d2;
33@@ -775,12 +778,9 @@ tfoot tr.overall-translation-stats th {
34 padding-bottom: 5px;
35 font-weight: bold;
36 }
37-tfoot tr.overall-translation-stats th {
38+table.translation-stats tfoot th {
39 text-align:left;
40 }
41-tfoot tr.overall-translation-stats td {
42+table.translation-stats tfoot td {
43 text-align:center;
44 }
45-table.narrow-listing {
46- width: 45em;
47-}
48
49=== modified file 'lib/lp/translations/browser/tests/test_breadcrumbs.py'
50--- lib/lp/translations/browser/tests/test_breadcrumbs.py 2009-09-10 10:27:20 +0000
51+++ lib/lp/translations/browser/tests/test_breadcrumbs.py 2009-09-11 08:20:13 +0000
52@@ -104,6 +104,9 @@ class TestTranslationGroupsBreadcrumbs(B
53 group_set = getUtility(ITranslationGroupSet)
54 url = canonical_url(group_set, rootsite='translations')
55 # Translation group listing is top-level, so no breadcrumbs show up.
56+ # Note that the first parameter is an empty list because
57+ # ITranslationGroupSet doesn't register Navigation class, and
58+ # thus doesn't show up in request.traversed_objects.
59 self._testContextBreadcrumbs(
60 [], [], [],
61 url=url)
62
63=== modified file 'lib/lp/translations/templates/serieslanguage-index.pt'
64--- lib/lp/translations/templates/serieslanguage-index.pt 2009-09-09 18:52:48 +0000
65+++ lib/lp/translations/templates/serieslanguage-index.pt 2009-09-11 08:20:21 +0000
66@@ -51,7 +51,7 @@
67 <div style="max-width:840px;">
68 <tal:navigation replace="structure view/batchnav/@@+navigation-links-upper" />
69
70- <table class="listing sortable" id="translationstatuses">
71+ <table class="listing sortable translation-stats">
72 <thead>
73 <tr>
74 <th>Template Name</th>
75@@ -64,7 +64,7 @@
76 <th>By</th>
77 </tr>
78 </thead>
79- <tbody class="translation-stats">
80+ <tbody>
81 <tr tal:repeat="entry view/pofiles"
82 tal:attributes="id string:${entry/potemplate/name}">
83 <td class="template-name">
84@@ -159,7 +159,7 @@
85 </td>
86 </tr>
87 <tfoot>
88- <tr class="overall-translation-stats">
89+ <tr>
90 <th>Overall statistics:</th>
91 <td><span tal:replace="context/messageCount">N</span></td>
92 <td>
93

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/icing/style-3-0.css'
2--- lib/canonical/launchpad/icing/style-3-0.css 2009-09-05 03:17:24 +0000
3+++ lib/canonical/launchpad/icing/style-3-0.css 2009-09-09 18:52:48 +0000
4@@ -748,6 +748,38 @@
5 padding: 2px 1em 2px 2px;
6 }
7
8+/* Translations statistics and legend.
9+ *
10+ * Examples:
11+ * https://translations.launchpad.dev/ubuntu/hoary/+lang/es
12+ * https://translations.launchpad.dev/evolution/trunk/+lang/es
13+ */
14+
15+div.translations-legend {
16+ padding-top: 2em;
17+ padding-bottom: 1em;
18+}
19+tbody.translation-stats td {
20+ text-align:center;
21+}
22+tbody.translation-stats td.template-name {
23+ text-align:left;
24+}
25+tfoot tr.overall-translation-stats td, th {
26+ background-color: #f7f7f7;
27+ border: 0px;
28+ border-top: 2px solid #d2d2d2;
29+ border-bottom: 2px solid #d2d2d2;
30+ padding-top: 5px;
31+ padding-bottom: 5px;
32+ font-weight: bold;
33+}
34+tfoot tr.overall-translation-stats th {
35+ text-align:left;
36+}
37+tfoot tr.overall-translation-stats td {
38+ text-align:center;
39+}
40 table.narrow-listing {
41 width: 45em;
42 }
43
44=== modified file 'lib/canonical/launchpad/pagetitles.py'
45--- lib/canonical/launchpad/pagetitles.py 2009-09-10 01:35:03 +0000
46+++ lib/canonical/launchpad/pagetitles.py 2009-09-10 10:27:20 +0000
47@@ -399,8 +399,6 @@
48
49 distroseries_queue = ContextTitle('Queue for %s')
50
51-distroserieslanguage_index = ContextTitle('%s')
52-
53 distroseriessourcepackagerelease_index = ContextTitle('%s')
54
55 errorservice_config = 'Configure error log'
56
57=== modified file 'lib/lp/translations/browser/configure.zcml'
58--- lib/lp/translations/browser/configure.zcml 2009-09-01 11:09:53 +0000
59+++ lib/lp/translations/browser/configure.zcml 2009-09-10 10:27:20 +0000
60@@ -35,12 +35,9 @@
61 <browser:page
62 name="+products-with-translations"
63 template="../templates/rosetta-products.pt"/>
64-
65+
66 <!-- portlets -->
67-
68- <browser:page
69- name="+portlet-stats"
70- template="../templates/rosetta-portlet-stats.pt"/>
71+
72 <browser:page
73 name="+portlet-groups"
74 template="../templates/rosetta-portlet-groups.pt"/>
75@@ -155,19 +152,22 @@
76 <browser:url
77 for="lp.translations.interfaces.distroserieslanguage.IDistroSeriesLanguage"
78 path_expression="string:+lang/${language/code}"
79- attribute_to_parent="distroseries"/>
80+ attribute_to_parent="distroseries"
81+ rootsite="translations"/>
82+ <browser:navigation
83+ module="lp.translations.browser.distroserieslanguage"
84+ classes="
85+ DistroSeriesLanguageNavigation"/>
86 <browser:defaultView
87 for="lp.translations.interfaces.distroserieslanguage.IDistroSeriesLanguage"
88- name="+index"/>
89+ name="+index"
90+ layer="canonical.launchpad.layers.TranslationsLayer"/>
91 <browser:pages
92 for="lp.translations.interfaces.distroserieslanguage.IDistroSeriesLanguage"
93 permission="zope.Public"
94 facet="translations"
95 layer="canonical.launchpad.layers.TranslationsLayer">
96 <browser:page
97- name="+portlet-stats"
98- template="../templates/distroserieslanguage-portlet-stats.pt"/>
99- <browser:page
100 name="+rosetta-status-legend"
101 template="../templates/rosetta-status-legend.pt"/>
102 </browser:pages>
103@@ -175,7 +175,7 @@
104 name="+index"
105 permission="zope.Public"
106 for="lp.translations.interfaces.distroserieslanguage.IDistroSeriesLanguage"
107- template="../templates/distroserieslanguage-index.pt"
108+ template="../templates/serieslanguage-index.pt"
109 class="lp.translations.browser.distroserieslanguage.DistroSeriesLanguageView"
110 facet="translations"
111 layer="canonical.launchpad.layers.TranslationsLayer"/>
112@@ -906,9 +906,6 @@
113 <browser:page
114 name="+langchart"
115 template="../templates/distroseries-langchart.pt"/>
116- <browser:page
117- name="+potlist"
118- template="../templates/object-pots.pt"/>
119 </browser:pages>
120 <browser:page
121 for="lp.registry.interfaces.distroseries.IDistroSeries"
122
123=== modified file 'lib/lp/translations/browser/distroserieslanguage.py'
124--- lib/lp/translations/browser/distroserieslanguage.py 2009-07-17 00:26:05 +0000
125+++ lib/lp/translations/browser/distroserieslanguage.py 2009-09-10 09:45:00 +0000
126@@ -5,17 +5,26 @@
127
128 __metaclass__ = type
129
130-__all__ = ['DistroSeriesLanguageView']
131+__all__ = [
132+ 'DistroSeriesLanguageNavigation',
133+ 'DistroSeriesLanguageView',
134+ ]
135
136 from canonical.launchpad.webapp import LaunchpadView
137 from canonical.launchpad.webapp.batching import BatchNavigator
138-
139+from canonical.launchpad.webapp.publisher import Navigation
140+from lp.translations.interfaces.distroserieslanguage import (
141+ IDistroSeriesLanguage)
142
143 class DistroSeriesLanguageView(LaunchpadView):
144 """View class to render translation status for an `IDistroSeries`."""
145
146 pofiles = None
147
148+ @property
149+ def page_title(self):
150+ return self.context.title
151+
152 def initialize(self):
153 self.form = self.request.form
154
155@@ -25,3 +34,23 @@
156
157 self.pofiles = self.context.getPOFilesFor(
158 self.batchnav.currentBatch())
159+ self.parent = self.context.distroseries.distribution
160+
161+ @property
162+ def translation_group(self):
163+ return self.context.distroseries.distribution.translationgroup
164+
165+ @property
166+ def translation_team(self):
167+ """Is there a translation team for this translation."""
168+ if self.translation_group is not None:
169+ team = self.translation_group.query_translator(
170+ self.context.language)
171+ else:
172+ team = None
173+ return team
174+
175+
176+class DistroSeriesLanguageNavigation(Navigation):
177+ """Navigation for `IDistroSeriesLanguage`."""
178+ usedfor = IDistroSeriesLanguage
179
180=== modified file 'lib/lp/translations/browser/tests/test_breadcrumbs.py'
181--- lib/lp/translations/browser/tests/test_breadcrumbs.py 2009-09-10 09:58:30 +0000
182+++ lib/lp/translations/browser/tests/test_breadcrumbs.py 2009-09-10 10:27:20 +0000
183@@ -98,6 +98,46 @@
184 ["Crumb Tester", "Translations"])
185
186
187+class TestTranslationGroupsBreadcrumbs(BaseTranslationsBreadcrumbTestCase):
188+
189+ def test_translationgroupset(self):
190+ group_set = getUtility(ITranslationGroupSet)
191+ url = canonical_url(group_set, rootsite='translations')
192+ # Translation group listing is top-level, so no breadcrumbs show up.
193+ self._testContextBreadcrumbs(
194+ [], [], [],
195+ url=url)
196+
197+ def test_translationgroup(self):
198+ group_set = getUtility(ITranslationGroupSet)
199+ group = self.factory.makeTranslationGroup(
200+ name='test-translators', title='Test translators')
201+ self._testContextBreadcrumbs(
202+ [group_set, group],
203+ ["http://translations.launchpad.dev/+groups",
204+ "http://translations.launchpad.dev/+groups/test-translators"],
205+ ["Translation groups", "Test translators"])
206+
207+
208+class TestSeriesLanguageBreadcrumbs(BaseTranslationsBreadcrumbTestCase):
209+ def setUp(self):
210+ super(TestSeriesLanguageBreadcrumbs, self).setUp()
211+ self.language = getUtility(ILanguageSet)['sr']
212+
213+ def test_distroserieslanguage(self):
214+ distribution = self.factory.makeDistribution(
215+ name='crumb-tester', displayname="Crumb Tester")
216+ series = self.factory.makeDistroRelease(
217+ name="test", version="1.0", distribution=distribution)
218+ serieslanguage = getUtility(IDistroSeriesLanguageSet).getDummy(
219+ series, self.language)
220+ self._testContextBreadcrumbs(
221+ [distribution, series, serieslanguage],
222+ ["http://launchpad.dev/crumb-tester",
223+ "http://launchpad.dev/crumb-tester/test",
224+ "http://translations.launchpad.dev/crumb-tester/test",
225+ "http://translations.launchpad.dev/crumb-tester/test/+lang/sr"],
226+ ["Crumb Tester", "1.0", "Translations", "Serbian (sr)"])
227
228
229 def test_suite():
230
231=== modified file 'lib/lp/translations/browser/translations.py'
232--- lib/lp/translations/browser/translations.py 2009-09-10 09:58:30 +0000
233+++ lib/lp/translations/browser/translations.py 2009-09-10 10:27:20 +0000
234@@ -9,6 +9,7 @@
235 'RosettaStatsView',
236 'RosettaApplicationNavigation',
237 'TranslateRedirectView',
238+ 'TranslationsLanguageBreadcrumb',
239 'TranslationsMixin',
240 'TranslationsRedirectView',
241 'TranslationsVHostBreadcrumb',
242@@ -192,3 +193,10 @@
243 @property
244 def text(self):
245 return 'Translations'
246+
247+
248+class TranslationsLanguageBreadcrumb(Breadcrumb):
249+ """Breadcrumb for objects with language."""
250+ @property
251+ def text(self):
252+ return self.context.language.displayname
253
254=== modified file 'lib/lp/translations/configure.zcml'
255--- lib/lp/translations/configure.zcml 2009-09-10 09:58:30 +0000
256+++ lib/lp/translations/configure.zcml 2009-09-10 10:27:20 +0000
257@@ -250,6 +250,12 @@
258
259 <!-- DistroSeriesLanguage and Dummy -->
260
261+ <adapter
262+ provides="canonical.launchpad.webapp.interfaces.IBreadcrumb"
263+ for="lp.translations.interfaces.distroserieslanguage.IDistroSeriesLanguage"
264+ factory="lp.translations.browser.translations.TranslationsLanguageBreadcrumb"
265+ permission="zope.Public"/>
266+
267 <class
268 class="lp.translations.model.distroserieslanguage.DistroSeriesLanguage">
269 <allow
270
271=== modified file 'lib/lp/translations/doc/canonical_url_examples.txt'
272--- lib/lp/translations/doc/canonical_url_examples.txt 2009-09-10 09:58:30 +0000
273+++ lib/lp/translations/doc/canonical_url_examples.txt 2009-09-10 10:27:20 +0000
274@@ -151,7 +151,7 @@
275 >>> boo_bah_serbian = getUtility(IDistroSeriesLanguageSet).getDummy(
276 ... distroseries, serbian)
277 >>> canonical_url(boo_bah_serbian)
278- u'http://launchpad.dev/boo/bah/+lang/sr'
279+ u'http://translations.launchpad.dev/boo/bah/+lang/sr'
280
281 Product, ProductSeries and ProductSeriesLanguage
282 ---------------------------------------------------
283
284=== modified file 'lib/lp/translations/model/distroserieslanguage.py'
285--- lib/lp/translations/model/distroserieslanguage.py 2009-07-17 00:26:05 +0000
286+++ lib/lp/translations/model/distroserieslanguage.py 2009-09-09 11:57:25 +0000
287@@ -52,10 +52,14 @@
288
289 @property
290 def title(self):
291- return '%s translations of applications in %s, %s' % (
292+ return '%s translations of %s %s' % (
293 self.language.englishname,
294 self.distroseries.distribution.displayname,
295- self.distroseries.title)
296+ self.distroseries.displayname)
297+
298+ @property
299+ def text(self):
300+ return self.language.englishname
301
302 @property
303 def pofiles(self):
304@@ -158,10 +162,10 @@
305 self.dateupdated = datetime.now(tz=pytz.timezone('UTC'))
306 self.translator_count = 0
307 self.contributor_count = 0
308- self.title = '%s translations of applications in %s, %s' % (
309+ self.title = '%s translations of %s %s' % (
310 self.language.englishname,
311 self.distroseries.distribution.displayname,
312- self.distroseries.title)
313+ self.distroseries.displayname)
314
315 @property
316 def pofiles(self):
317
318=== modified file 'lib/lp/translations/stories/standalone/xx-test-potlists.txt'
319--- lib/lp/translations/stories/standalone/xx-test-potlists.txt 2009-07-01 20:45:39 +0000
320+++ lib/lp/translations/stories/standalone/xx-test-potlists.txt 2009-09-09 12:41:48 +0000
321@@ -11,17 +11,3 @@
322 ...
323 ...Listing of FEW templates...
324 ...
325-
326-Check that we can get a potlist for a distroseries:
327-
328- >>> print http(r"""
329- ... GET /ubuntu/hoary/+potlist HTTP/1.1
330- ... Host: translations.launchpad.dev
331- ... """)
332- HTTP/1.1 200 Ok
333- Content-Length: ...
334- Content-Type: text/html;charset=utf-8
335- <BLANKLINE>
336- ...
337- ...Listing of FEW templates...
338- ...
339
340=== modified file 'lib/lp/translations/stories/translations/43-distrorelease-translations.txt'
341--- lib/lp/translations/stories/translations/43-distrorelease-translations.txt 2008-09-09 08:13:14 +0000
342+++ lib/lp/translations/stories/translations/43-distrorelease-translations.txt 2009-09-09 12:41:48 +0000
343@@ -43,7 +43,7 @@
344 ... 'http://translations.launchpad.dev/ubuntu/hoary/+lang/hr?batch=2')
345 >>> 'Croatian' in browser.contents
346 True
347- >>> 'Programs you can translate' in browser.contents
348+ >>> 'Translatable templates' in browser.contents
349 True
350 >>> print browser.getLink('evolution-2.2').url
351 http://translations.launchpad.dev/ubuntu/hoary/+source/evolution/+pots/evolution-2.2/hr/+translate
352
353=== removed file 'lib/lp/translations/templates/distroserieslanguage-portlet-stats.pt'
354--- lib/lp/translations/templates/distroserieslanguage-portlet-stats.pt 2009-07-17 17:59:07 +0000
355+++ lib/lp/translations/templates/distroserieslanguage-portlet-stats.pt 1970-01-01 00:00:00 +0000
356@@ -1,25 +0,0 @@
357-<div
358- xmlns:tal="http://xml.zope.org/namespaces/tal"
359- xmlns:metal="http://xml.zope.org/namespaces/metal"
360- xmlns:i18n="http://xml.zope.org/namespaces/i18n"
361- class="portlet" id="portlet-stats">
362-
363- <h2><span tal:replace="context/language/englishname">French</span>
364- statistics in <span
365- tal:replace="context/distroseries/displayname">Hoary</span></h2>
366-
367- <div class="portletBody portletContent">
368-
369- <b>Translatable items:</b>
370- <span tal:replace="context/messageCount">N</span>
371- <br/>
372- <b>Untranslated:</b>
373- <span tal:replace="context/untranslatedCount">N</span>
374- <br />
375- <span style="white-space: nowrap"
376- tal:content="structure context/@@+barchart">--</span>
377- <br />
378-
379- </div>
380-
381-</div>
382
383=== renamed file 'lib/lp/translations/templates/distroserieslanguage-index.pt' => 'lib/lp/translations/templates/serieslanguage-index.pt'
384--- lib/lp/translations/templates/distroserieslanguage-index.pt 2009-07-17 17:59:07 +0000
385+++ lib/lp/translations/templates/serieslanguage-index.pt 2009-09-09 18:52:48 +0000
386@@ -2,27 +2,11 @@
387 xmlns="http://www.w3.org/1999/xhtml"
388 xmlns:tal="http://xml.zope.org/namespaces/tal"
389 xmlns:metal="http://xml.zope.org/namespaces/metal"
390- xmlns:i18n="http://xml.zope.org/namespaces/i18n"
391- xml:lang="en"
392- lang="en"
393- dir="ltr"
394- metal:use-macro="context/@@main_template/master"
395- i18n:domain="rosetta"
396+ metal:use-macro="view/macro:page/main_only"
397 >
398
399 <body>
400
401-<metal:rightportlets fill-slot="portlets_one">
402- <div tal:replace="structure context/@@+portlet-stats" />
403-</metal:rightportlets>
404-
405-<metal:heading fill-slot="pageheading">
406- <h1>
407- Programs you can translate into
408- <tal:language replace="context/language/englishname">Catalan</tal:language>
409- </h1>
410-</metal:heading>
411-
412 <div metal:fill-slot="main">
413 <tal:block condition="not:view/pofiles">
414 <div class="documentDescription">
415@@ -31,15 +15,43 @@
416 </tal:block>
417
418 <tal:block condition="view/pofiles">
419-
420- <p>
421- Choose a template name to begin translating. Templates that are
422- considered more important for translation are listed first.
423- </p>
424-
425+ <h1>Translatable templates</h1>
426+ <div class="top-portlet">
427+ <tal:with_group condition="view/translation_group">
428+ <p tal:condition="view/translation_team">
429+ <tal:product replace="structure
430+ view/parent/fmt:link">Evolution</tal:product>
431+ is translated by
432+ <tal:team replace="structure
433+ view/translation_team/translator/fmt:link">
434+ Serbian translators</tal:team> — if you need help, or your
435+ translations are not being reviewed, please get in touch with them.
436+ </p>
437+
438+ <p tal:condition="not:view/translation_team">
439+ There is no team to translate
440+ <tal:product replace="structure
441+ view/parent/fmt:link">Evolution</tal:product>
442+ to
443+ <a tal:attributes="href context/language/fmt:url"
444+ tal:content="context/language/englishname">Serbian</a>.
445+ To set one up, please get in touch with
446+ <a tal:replace="structure view/translation_group/fmt:link"
447+ >Launchpad Translators</a>
448+ coordinator.
449+ </p>
450+ </tal:with_group>
451+
452+ <p>
453+ Choose a template name to begin translating.
454+ Templates which are more important to translate are listed first.
455+ </p>
456+ </div>
457+
458+ <div style="max-width:840px;">
459 <tal:navigation replace="structure view/batchnav/@@+navigation-links-upper" />
460
461- <table class="listing sortable" width="100%" id="translationstatuses">
462+ <table class="listing sortable" id="translationstatuses">
463 <thead>
464 <tr>
465 <th>Template Name</th>
466@@ -52,10 +64,10 @@
467 <th>By</th>
468 </tr>
469 </thead>
470- <tbody>
471+ <tbody class="translation-stats">
472 <tr tal:repeat="entry view/pofiles"
473 tal:attributes="id string:${entry/potemplate/name}">
474- <td>
475+ <td class="template-name">
476 <a tal:attributes="href string:${entry/fmt:url}/+translate"
477 tal:content="entry/potemplate/name">
478 apache2-dev
479@@ -146,34 +158,31 @@
480 </tal:block>
481 </td>
482 </tr>
483+ <tfoot>
484+ <tr class="overall-translation-stats">
485+ <th>Overall statistics:</th>
486+ <td><span tal:replace="context/messageCount">N</span></td>
487+ <td>
488+ <span style="white-space: nowrap"
489+ tal:content="structure context/@@+barchart">--</span>
490+ </td>
491+ <td><span tal:replace="context/untranslatedCount">N</span></td>
492+ <td><span tal:replace="context/unreviewedCount">N</span></td>
493+ <td><span tal:replace="context/updatesCount">N</span></td>
494+ <td colspan="2"></td>
495+ </tr>
496+ </tfoot>
497 </tbody>
498 </table>
499-
500 <tal:navigation replace="structure view/batchnav/@@+navigation-links-lower" />
501
502- <div tal:replace="structure context/@@+rosetta-status-legend" />
503-
504+ <div class="translations-legend">
505+ <div tal:replace="structure context/@@+rosetta-status-legend" />
506+ </div>
507+ </div><!-- max-width -->
508 </tal:block>
509
510 </div>
511
512-<div metal:fill-slot="help">
513- <p>
514- This page shows each of the translation templates in each of the source
515- packages in the
516- <span tal:replace="context/distroseries/displayname">hoary</span>
517- series of
518- <span tal:replace="context/distroseries/distribution/displayname">Ubuntu
519- </span>. Select a template to start translating.
520- </p>
521- <ul class="info">
522- <li>
523- <a href="https://help.launchpad.net/RosettaFAQ"
524- >Frequently asked questions</a>
525- </li>
526- </ul>
527-</div>
528-
529-
530 </body>
531 </html>
532

Subscribers

People subscribed via source and target branches

to all changes: