Merge lp://staging/~jtv/launchpad/bug-426093 into lp://staging/launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~jtv/launchpad/bug-426093
Merge into: lp://staging/launchpad
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~jtv/launchpad/bug-426093
Reviewer Review Type Date Requested Status
Abel Deuring (community) Approve
Review via email: mp+11605@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Bug 426093: Mechanical 3.0 conversion of Translations front page =

We have real UI improvements planned for the main Translations page, but
meanwhile here's a (relatively) quick and direct 3.0 conversion.

Highlights:
 * A formatter for Language objects.
 * Some serious re-indenting in the template.
 * Removal of the redundant Help link right after the Tour button.
 * A <div class="columns"> around the 3-column section.

I also threw in a wording change for free: on the front page, "Preferred
languages" becomes "Your preferred languages." Maybe we'll scratch this
section altogether later (in favour of a planned languages section on
the personal page) but for now, nothing else we list on that page is
specific to the user so it's worth being clear about this exception.

One test is affected:
{{{
./bin/test -vv -t rosetta-homepage
}}}

Otherwise, a pretty unsurprising change. No lint complaints, apart from
one of those "unable to import" ones that have been showing up all over
the place recently and seem to have nothing to do with my branches.

Jeroen

Revision history for this message
Abel Deuring (adeuring) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/webapp/configure.zcml'
2--- lib/canonical/launchpad/webapp/configure.zcml 2009-09-10 10:49:44 +0000
3+++ lib/canonical/launchpad/webapp/configure.zcml 2009-09-11 13:42:52 +0000
4@@ -520,6 +520,12 @@
5 name="fmt"
6 />
7 <adapter
8+ for="lp.services.worlddata.interfaces.language.ILanguage"
9+ provides="zope.traversing.interfaces.IPathAdapter"
10+ factory="canonical.launchpad.webapp.tales.LanguageFormatterAPI"
11+ name="fmt"
12+ />
13+ <adapter
14 for="*"
15 provides="zope.traversing.interfaces.IPathAdapter"
16 factory="canonical.launchpad.webapp.tales.PermissionRequiredQuery"
17
18=== modified file 'lib/canonical/launchpad/webapp/tales.py'
19--- lib/canonical/launchpad/webapp/tales.py 2009-09-10 12:39:52 +0000
20+++ lib/canonical/launchpad/webapp/tales.py 2009-09-11 13:42:52 +0000
21@@ -3191,3 +3191,27 @@
22 def displayname(self, view_name, rootsite=None):
23 """Return the displayname as a string."""
24 return self._context.title
25+
26+
27+class LanguageFormatterAPI(ObjectFormatterAPI):
28+ """Adapter for `ILanguage` objects to a formatted string."""
29+
30+ traversable_names = {
31+ 'link': 'link',
32+ 'url': 'url',
33+ 'displayname': 'displayname',
34+ }
35+
36+ def url(self, view_name=None, rootsite='translations'):
37+ """See `ObjectFormatterAPI`."""
38+ return super(LanguageFormatterAPI, self).url(view_name, rootsite)
39+
40+ def link(self, view_name, rootsite='translations'):
41+ """See `ObjectFormatterAPI`."""
42+ url = self.url(view_name, rootsite)
43+ return u'<a href="%s" class="sprite language">%s</a>' % (
44+ url, cgi.escape(self._context.englishname))
45+
46+ def displayname(self, view_name, rootsite=None):
47+ """See `ObjectFormatterAPI`."""
48+ return self._context.englishname
49
50=== modified file 'lib/lp/translations/stories/standalone/xx-rosetta-homepage.txt'
51--- lib/lp/translations/stories/standalone/xx-rosetta-homepage.txt 2009-07-01 20:45:39 +0000
52+++ lib/lp/translations/stories/standalone/xx-rosetta-homepage.txt 2009-09-11 13:15:51 +0000
53@@ -33,7 +33,7 @@
54 >>> right_column = find_tags_by_class(
55 ... browser.contents, 'three column right')[0]
56 >>> print extract_text(right_column)
57- Preferred languages
58+ Your preferred languages
59 Afrikaans
60 Sotho, Southern
61 Xhosa
62
63=== modified file 'lib/lp/translations/templates/rosetta-index.pt'
64--- lib/lp/translations/templates/rosetta-index.pt 2009-07-17 17:59:07 +0000
65+++ lib/lp/translations/templates/rosetta-index.pt 2009-09-11 13:42:52 +0000
66@@ -3,119 +3,93 @@
67 xmlns:tal="http://xml.zope.org/namespaces/tal"
68 xmlns:metal="http://xml.zope.org/namespaces/metal"
69 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
70- xml:lang="en"
71- lang="en"
72- dir="ltr"
73- metal:use-macro="view/macro:page/applicationhome"
74+ metal:use-macro="view/macro:page/searchless"
75 i18n:domain="launchpad">
76+
77 <body>
78 <h1 metal:fill-slot="heading">Software translations</h1>
79+
80 <div metal:fill-slot="main">
81-
82- <ul class="buttons">
83- <li>
84- <a href="/+tour/translation"
85- tal:attributes="href string:${rooturl}+tour/translation">
86- <img
87- alt="Take a tour"
88- src="/+icing/but-lrg-takeatour.gif"
89- />
90- </a>
91- </li>
92- <li>
93- <a href="https://help.launchpad.net/Translations"
94- id="link-to-translations-help">
95- Help for translations
96- </a>
97- </li>
98- </ul>
99- <form class="central" action="/projects/" method="get">
100- <input id="text" name="text" size="50" type="text" />
101- <input type="submit" value="Search Projects" />
102- </form>
103- <p id="application-summary">
104- Launchpad helps you build a community to
105- translate your project into almost any
106- language. Translators use this simple web
107- interface to contribute translations in a
108- wiki-style of collaboration. (<a href="https://help.launchpad.net/Translations"
109- >Read our guide</a>)
110- </p>
111-
112- <div class="three column left">
113-
114- <h2>Translatable operating systems</h2>
115- <ul class="distroseries">
116- <li tal:repeat="distroseries context/translatable_distroseriess">
117- <a tal:attributes="href string:/${distroseries/distribution/name}/${distroseries/name}/+translations">
118- <tal:distroname replace="distroseries/distribution/displayname" />
119- <tal:version
120- condition="distroseries/version"
121- replace="distroseries/version"
122- />
123- <tal:codename
124- condition="not:distroseries/version"
125- replace="distroseries/title"
126- />
127- </a>
128- </li>
129- </ul>
130-
131- </div>
132- <div class="three column middle">
133-
134- <h2>Translatable projects</h2>
135- <span
136- tal:repeat="product context/featured_products"
137- tal:attributes="style string:font-size:${product/font_size}%;">
138- <a
139- tal:attributes="
140- href string:${product/pillar/fmt:url}/+translations"
141- tal:content="product/pillar/displayname" />
142- </span>
143- <div>
144- <a href="+products-with-translations">
145- &raquo; List all translatable projects...</a>
146- </div>
147-
148- </div>
149- <div class="three column right">
150- <h2>Preferred languages</h2>
151- <ul>
152- <li tal:repeat="language view/translatable_languages">
153- <a
154- tal:attributes="href language/fmt:url"
155- tal:content="language/englishname"
156- class="sprite language">
157- Spanish
158- </a>
159- </li>
160- </ul>
161- <a href="/+editmylanguages">
162- &raquo; Change your preferred languages...
163- </a>
164- </div>
165- <div
166- id="application-footer"
167- tal:content="structure context/@@+portlet-stats"
168- />
169-
170- </div><!--main-->
171- <div metal:fill-slot="help">
172- <p>
173- Launchpad's translation application, codenamed
174- <a href="+about">Launchpad Translations</a>, helps you translate open source software
175- into any human language through the Web. All you need to start
176- translating is a Web browser, a good knowledge of the application you
177- are translating, and a working knowledge of both English and your
178- target language.
179- </p>
180- <ul class="info">
181+ <ul class="rollover buttons">
182 <li>
183- <a href="https://help.launchpad.net/RosettaFAQ"
184- >Frequently asked questions</a>
185+ <a href="/+tour/translation"
186+ tal:attributes="href string:${rooturl}+tour/translation">
187+ <img
188+ alt="Take a tour"
189+ src="/+icing/but-lrg-takeatour.gif"
190+ />
191+ </a>
192 </li>
193 </ul>
194- </div>
195+
196+ <form class="central" action="/projects/" method="get">
197+ <input id="text" name="text" size="50" type="text" />
198+ <input type="submit" value="Search Projects" />
199+ </form>
200+
201+ <p id="application-summary">
202+ Launchpad helps you build a community to translate your project into
203+ almost any language. Translators use this simple web interface to
204+ contribute translations in a wiki-style of collaboration.
205+ (<a href="https://help.launchpad.net/Translations"
206+ id="link-to-translations-help">Read our guide</a>)
207+ </p>
208+
209+ <div class="columns">
210+
211+ <div class="three column left">
212+ <h2>Translatable operating systems</h2>
213+ <ul class="distroseries">
214+ <li tal:repeat="distroseries context/translatable_distroseriess">
215+ <a tal:attributes="href string:/${distroseries/distribution/name}/${distroseries/name}/+translations">
216+ <tal:distroname replace="distroseries/distribution/displayname" />
217+ <tal:version
218+ condition="distroseries/version"
219+ replace="distroseries/version"
220+ />
221+ <tal:codename
222+ condition="not:distroseries/version"
223+ replace="distroseries/title"
224+ />
225+ </a>
226+ </li>
227+ </ul>
228+ </div>
229+
230+ <div class="three column middle">
231+ <h2>Translatable projects</h2>
232+ <span
233+ tal:repeat="product context/featured_products"
234+ tal:attributes="style string:font-size:${product/font_size}%;">
235+ <a
236+ tal:attributes="
237+ href string:${product/pillar/fmt:url}/+translations"
238+ tal:content="product/pillar/displayname" />
239+ </span>
240+ <div>
241+ <a href="+products-with-translations">
242+ &raquo; List all translatable projects...</a>
243+ </div>
244+ </div>
245+
246+ <div class="three column right">
247+ <h2>Your preferred languages</h2>
248+ <ul>
249+ <li tal:repeat="language view/translatable_languages">
250+ <a tal:replace="structure language/fmt:link">
251+ Spanish
252+ </a>
253+ </li>
254+ </ul>
255+ <a href="/+editmylanguages">
256+ &raquo; Change your preferred languages...
257+ </a>
258+ </div>
259+
260+ </div>
261+
262+ <div id="application-footer"
263+ tal:content="structure context/@@+portlet-stats" />
264+ </div><!--main-->
265 </body>
266 </html>