Merge lp:~adiroiban/launchpad/bug-193750 into lp:launchpad

Proposed by Adi Roiban
Status: Merged
Approved by: Henning Eggers
Approved revision: not available
Merge reported by: Adi Roiban
Merged at revision: not available
Proposed branch: lp:~adiroiban/launchpad/bug-193750
Merge into: lp:launchpad
Diff against target: 194 lines (+85/-11)
3 files modified
lib/lp/translations/browser/language.py (+8/-0)
lib/lp/translations/stories/standalone/xx-language.txt (+68/-7)
lib/lp/translations/templates/language-index.pt (+9/-4)
To merge this branch: bzr merge lp:~adiroiban/launchpad/bug-193750
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+15292@code.launchpad.net

Commit message

Update the links for adding a question for Rosetta from addticket to addquestion. Make them use the answers.lp.net domain name.

To post a comment you must log in.
Revision history for this message
Adi Roiban (adiroiban) wrote :

= Bug 193750 =

== Proposed fix ==

The fix should replace "ticket" to "question" and update the required answer links for addticket to addquestions.

Also instead on translations.lp.dev/rosetta/addticket the url was replaces to answers.lp.dev/rosetta/addquestion to have a clean namespace

== Implementation details ==

There were no test for checking the cases when those links should appear so I have added the required pagetests.

The translate.txt pagetest was also structured... but a bit.

== Tests ==

./bin/test -ct language

== Demo and Q/A ==

Abkhazian is a language that has no information about plural forms and is not registered as being spoken in any country.

We will see a note about missing plural forms and a link to Rosetta
add question page for informing Rosetta admin about the right plural form.

    >>> browser.open('http://translations.launchpad.dev/+languages/ab')
    >>> print extract_text(find_portlet(browser.contents, 'Plural forms'
    ... ).renderContents())
    Plural forms
    Unfortunately, Launchpad doesn't know the plural
    form information for this language...

    >>> print browser.getLink(id='plural_question').url
    http://answers.launchpad.dev/rosetta/+addquestion

We will see a note that this language is not registred as being spoken in any
country and a link to add question page for informating Rosetta admin about the
countries where this page is officially spoken.

    >>> countries_portlet = find_portlet(browser.contents, 'Countries')
    >>> print countries_portlet
    <...
    Abkhazian is not registered as being spoken in any
    country...

    >>> print browser.getLink(id='country_question').url
    http://answers.launchpad.dev/rosetta/+addquestion

== lint ==

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

Linting changed files:
  lib/lp/translations/browser/language.py
  lib/lp/translations/stories/standalone/xx-language.txt
  lib/lp/translations/templates/language-index.pt

Revision history for this message
Abel Deuring (adeuring) wrote :
Download full text (9.1 KiB)

Hi Adi,

a very nice branch! I have only a number of mostly formal nitpicks,
see below.

When you have fixed these small issues, I'll ec2-test the branch and
land it on your behalf.

Abel

>
> = Bug 193750 =
>
> == Proposed fix ==
>
> The fix should replace "ticket" to "question" and update the required answer links for addticket to addquestions.
>
> Also instead on translations.lp.dev/rosetta/addticket the url was replaces to answers.lp.dev/rosetta/addquestion to have a clean namespace
>
> == Implementation details ==
>
> There were no test for checking the cases when those links should appear so I have added the required pagetests.

Thanks for adding them!

>
> The translate.txt pagetest was also structured... but a bit.
>
> == Tests ==
>
> ./bin/test -ct language
>
> == Demo and Q/A ==
>
> Abkhazian is a language that has no information about plural forms and is not registered as being spoken in any country.
>
> We will see a note about missing plural forms and a link to Rosetta
> add question page for informing Rosetta admin about the right plural form.
>
> >>> browser.open('http://translations.launchpad.dev/+languages/ab')
> >>> print extract_text(find_portlet(browser.contents, 'Plural forms'
> ... ).renderContents())
> Plural forms
> Unfortunately, Launchpad doesn't know the plural
> form information for this language...
>
> >>> print browser.getLink(id='plural_question').url
> http://answers.launchpad.dev/rosetta/+addquestion
>
> We will see a note that this language is not registred as being spoken in any
> country and a link to add question page for informating Rosetta admin about the
> countries where this page is officially spoken.
>
> >>> countries_portlet = find_portlet(browser.contents, 'Countries')
> >>> print countries_portlet
> <...
> Abkhazian is not registered as being spoken in any
> country...
>
> >>> print browser.getLink(id='country_question').url
> http://answers.launchpad.dev/rosetta/+addquestion
>
> == lint ==
>
> Checking for conflicts. and issues in doctests and templates.
> Running jslint, xmllint, pyflakes, and pylint.
> Using normal rules.
>
> Linting changed files:
> lib/lp/translations/browser/language.py
> lib/lp/translations/stories/standalone/xx-language.txt
> lib/lp/translations/templates/language-index.pt
>
>
> === modified file 'lib/lp/translations/browser/language.py'
> --- lib/lp/translations/browser/language.py 2009-10-31 11:06:44 +0000
> +++ lib/lp/translations/browser/language.py 2009-11-26 19:30:28 +0000
> @@ -29,6 +29,7 @@
> enabled_with_permission, GetitemNavigation, LaunchpadEditFormView,
> LaunchpadFormView, LaunchpadView, Link, NavigationMenu)
> from lp.translations.utilities.pluralforms import make_friendly_plural_forms
> +from lp.registry.interfaces.product import IProductSet
>
> from canonical.widgets import LabeledMultiCheckBoxWidget
>
> @@ -202,6 +203,13 @@
>
> return pluralforms_list
>
> + @property
> + def add_question_url(self):
> + rosetta = getUtility(IProductSet).getByName('rosetta')

Here you use the rosetta project not as an ordinary project that can
be replaced by any other pro...

Read more...

review: Approve (code)
Revision history for this message
Adi Roiban (adiroiban) wrote :

Thanks for the review.
I have done the required changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/translations/browser/language.py'
--- lib/lp/translations/browser/language.py 2009-10-31 11:06:44 +0000
+++ lib/lp/translations/browser/language.py 2009-12-07 08:16:13 +0000
@@ -29,6 +29,7 @@
29 enabled_with_permission, GetitemNavigation, LaunchpadEditFormView,29 enabled_with_permission, GetitemNavigation, LaunchpadEditFormView,
30 LaunchpadFormView, LaunchpadView, Link, NavigationMenu)30 LaunchpadFormView, LaunchpadView, Link, NavigationMenu)
31from lp.translations.utilities.pluralforms import make_friendly_plural_forms31from lp.translations.utilities.pluralforms import make_friendly_plural_forms
32from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
3233
33from canonical.widgets import LabeledMultiCheckBoxWidget34from canonical.widgets import LabeledMultiCheckBoxWidget
3435
@@ -202,6 +203,13 @@
202203
203 return pluralforms_list204 return pluralforms_list
204205
206 @property
207 def add_question_url(self):
208 rosetta = getUtility(ILaunchpadCelebrities).lp_translations
209 return canonical_url(
210 rosetta,
211 view_name='+addquestion',
212 rootsite='answers')
205213
206class LanguageAdminView(LaunchpadEditFormView):214class LanguageAdminView(LaunchpadEditFormView):
207 """Handle an admin form submission."""215 """Handle an admin form submission."""
208216
=== modified file 'lib/lp/translations/stories/standalone/xx-language.txt'
--- lib/lp/translations/stories/standalone/xx-language.txt 2009-10-31 11:06:44 +0000
+++ lib/lp/translations/stories/standalone/xx-language.txt 2009-12-07 08:16:13 +0000
@@ -1,6 +1,15 @@
1
2
3Languages view
4==============
5
1Here is the tale of languages. We will see how to create, find and edit6Here is the tale of languages. We will see how to create, find and edit
2them.7them.
38
9
10Getting there
11-------------
12
4Launchpad Translations has a main page.13Launchpad Translations has a main page.
514
6 >>> admin_browser.open('http://translations.launchpad.dev/')15 >>> admin_browser.open('http://translations.launchpad.dev/')
@@ -11,7 +20,12 @@
11 >>> print admin_browser.url20 >>> print admin_browser.url
12 http://translations.launchpad.dev/+languages21 http://translations.launchpad.dev/+languages
1322
14Following the link, there is a form to add new languages.23
24Adding new languages
25--------------------
26
27Following the link from the translations main page, there is a form to
28add new languages.
1529
16 >>> admin_browser.getLink('Add new language').click()30 >>> admin_browser.getLink('Add new language').click()
17 >>> print admin_browser.url31 >>> print admin_browser.url
@@ -65,11 +79,16 @@
65 ...79 ...
66 LinkNotFoundError80 LinkNotFoundError
6781
68 >>> user_browser.open('http://translations.launchpad.dev/+languages/+add')82 >>> user_browser.open(
83 ... 'http://translations.launchpad.dev/+languages/+add')
69 Traceback (most recent call last):84 Traceback (most recent call last):
70 ...85 ...
71 Unauthorized:...86 Unauthorized:...
7287
88
89Searching for a language
90------------------------
91
73From the top languages page, anyone can find languages.92From the top languages page, anyone can find languages.
7493
75 >>> browser.open('http://translations.launchpad.dev/+languages')94 >>> browser.open('http://translations.launchpad.dev/+languages')
@@ -82,7 +101,11 @@
82 >>> print browser.url101 >>> print browser.url
83 http://translations.launchpad.dev/+languages/+index?find=Spanish102 http://translations.launchpad.dev/+languages/+index?find=Spanish
84103
85And following one of the found languages, we can see a brief information104
105Read language information
106-------------------------
107
108Following one of the found languages, we can see a brief information
86about the selected language.109about the selected language.
87110
88 >>> browser.getLink('Spanish').click()111 >>> browser.getLink('Spanish').click()
@@ -128,14 +151,50 @@
128 ...Uruguay...151 ...Uruguay...
129 ...Venezuela...152 ...Venezuela...
130153
131 >>> topcontributors_portlet = find_portlet(browser.contents, 'Top contributors')154 >>> topcontributors_portlet = find_portlet(
155 ... browser.contents, 'Top contributors')
132 >>> print topcontributors_portlet156 >>> print topcontributors_portlet
133 <...157 <...
134 ...Carlos Perelló Marín...158 ...Carlos Perelló Marín...
135159
160Our test sample data does not know about plural forms of
161Abkhazian and about countries where this language is spoken.
162
163We will see a note about missing plural forms and a link to Rosetta
164add question page for informing Rosetta admin about the right plural
165form.
166
167 >>> browser.open('http://translations.launchpad.dev/+languages/ab')
168 >>> print extract_text(find_portlet(browser.contents, 'Plural forms'
169 ... ).renderContents())
170 Plural forms
171 Unfortunately, Launchpad doesn't know the plural
172 form information for this language...
173
174 >>> print browser.getLink(id='plural_question').url
175 http://answers.launchpad.dev/rosetta/+addquestion
176
177We will see a note that Launchpad does not know in which countries
178this language is spoken and a link to add question page for informing
179Rosetta admin about the countries where this page is officially spoken.
180
181 >>> countries_portlet = find_portlet(browser.contents, 'Countries')
182 >>> print countries_portlet
183 <...
184 Abkhazian is not registered as being spoken in any
185 country...
186
187 >>> print browser.getLink(id='country_question').url
188 http://answers.launchpad.dev/rosetta/+addquestion
189
190
191Edit language information
192-------------------------
193
136Finally, there is the edit form to change language basic information.194Finally, there is the edit form to change language basic information.
137195
138 >>> user_browser.open('http://translations.launchpad.dev/+languages/es')196 >>> user_browser.open(
197 ... 'http://translations.launchpad.dev/+languages/es')
139 >>> print user_browser.url198 >>> print user_browser.url
140 http://translations.launchpad.dev/+languages/es199 http://translations.launchpad.dev/+languages/es
141200
@@ -146,7 +205,8 @@
146 ...205 ...
147 LinkNotFoundError206 LinkNotFoundError
148207
149 >>> user_browser.open('http://translations.launchpad.dev/+languages/es/+admin')208 >>> user_browser.open(
209 ... 'http://translations.launchpad.dev/+languages/es/+admin')
150 Traceback (most recent call last):210 Traceback (most recent call last):
151 ...211 ...
152 Unauthorized:...212 Unauthorized:...
@@ -155,7 +215,8 @@
155215
156 >>> from canonical.launchpad.testing.pages import strip_label216 >>> from canonical.launchpad.testing.pages import strip_label
157217
158 >>> admin_browser.open('http://translations.launchpad.dev/+languages/es')218 >>> admin_browser.open(
219 ... 'http://translations.launchpad.dev/+languages/es')
159 >>> print admin_browser.url220 >>> print admin_browser.url
160 http://translations.launchpad.dev/+languages/es221 http://translations.launchpad.dev/+languages/es
161222
162223
=== modified file 'lib/lp/translations/templates/language-index.pt'
--- lib/lp/translations/templates/language-index.pt 2009-09-17 14:45:59 +0000
+++ lib/lp/translations/templates/language-index.pt 2009-12-07 08:16:13 +0000
@@ -43,8 +43,10 @@
43 <p class="helpwanted">43 <p class="helpwanted">
44 Unfortunately, Launchpad doesn't know the plural form44 Unfortunately, Launchpad doesn't know the plural form
45 information for this language. If you know it, please open a45 information for this language. If you know it, please open a
46 <a href="/rosetta/+addticket">ticket</a> with that information,46 <a id='plural_question'
47 so we can add it to Launchpad.47 tal:attributes="href view/add_question_url"
48 >question</a>
49 with that information, so we can add it to Launchpad.
48 </p>50 </p>
49 </tal:has_not_pluralforms>51 </tal:has_not_pluralforms>
50 </div>52 </div>
@@ -124,8 +126,11 @@
124 </tal:language>126 </tal:language>
125 is not registered as being spoken in any country. If you know127 is not registered as being spoken in any country. If you know
126 about a country that officially speaks this language, please128 about a country that officially speaks this language, please
127 open a <a href="/rosetta/+addticket">ticket</a> with that129 open a
128 information, so we can add it to Launchpad.130 <a id='country_question'
131 tal:attributes="href view/add_question_url"
132 >question</a>
133 with that information, so we can add it to Launchpad.
129 </p>134 </p>
130 </tal:has_not_countries>135 </tal:has_not_countries>
131 </div>136 </div>