~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
= Distribution series translations =

This page shows a list of PO templates contained within all source
packages in a particular distibution series.

We are going to work with visible (Spanish) and non visible
(Spanish (Spain)) languages.

Here we can see that Spanish (Spain) is not visible.

    >>> admin_browser.open(
    ...     'http://translations.launchpad.dev/+languages/es_ES/+admin')
    >>> print admin_browser.getControl('The English name').value
    Spanish (Spain)
    >>> admin_browser.getControl('Visible').selected
    False

But Spanish is visible.

    >>> admin_browser.open(
    ...     'http://translations.launchpad.dev/+languages/es/+admin')
    >>> print admin_browser.getControl('The English name').value
    Spanish
    >>> admin_browser.getControl('Visible').selected
    True

In this case, we're asking for the translation overview for Hoary.

    >>> anon_browser.open('http://translations.launchpad.dev/ubuntu/hoary')

The system is not showing non visible languages:

    >>> anon_browser.getLink('Spanish (Spain)')
    Traceback (most recent call last):
    ...
    LinkNotFoundError

The system will not show English because it is not translatable:

    >>> anon_browser.getLink('English')
    Traceback (most recent call last):
    ...
    LinkNotFoundError

But it shows the ones not hidden:

    >>> print anon_browser.getLink('Spanish').url
    http://translations.launchpad.dev/ubuntu/hoary/+lang/es

Launchpad has an option to hide all of the translations for a distribution
series.  The link to hide translations is not available to anonymous users:

    >>> anon_browser.getLink('Change settings')
    Traceback (most recent call last):
    ...
    LinkNotFoundError

And the page is not available either:

    >>> anon_browser.open(
    ...     'http://translations.launchpad.dev/ubuntu/hoary/+admin')
    Traceback (most recent call last):
    ...
    Unauthorized:...

... but the link is available to administrators:

    >>> admin_browser.open('http://translations.launchpad.dev/ubuntu/hoary')

    >>> admin_browser.getLink('Change settings').click()

Once the administrator hides all translations...

    >>> admin_browser.getControl(
    ...     'Hide translations for this release').selected = True
    >>> admin_browser.getControl('Change').click()
    >>> print admin_browser.url
    http://translations.launchpad.dev/ubuntu/hoary

...a notice about the fact shows up on the overview page.

    >>> notices = find_tags_by_class(
    ...     admin_browser.contents, 'visibility-notice')
    >>> for notice in notices:
    ...     print extract_text(notice)
    Translations for this series are currently hidden.

Now, the translation status page will no longer display any languages to
regular users.

    >>> user_browser.open('http://translations.launchpad.dev/ubuntu/hoary')
    Traceback (most recent call last):
    ...
    TranslationUnavailable: ...

Also, if the user tries to navigate directly to launchpad pages,
the system tells them that they're not allowed to see those pages.

    >>> user_browser.handleErrors = True
    >>> user_browser.open(
    ...     'http://translations.launchpad.dev/ubuntu/hoary/+lang/es')
    Traceback (most recent call last):
    ...
    HTTPError: HTTP Error 503: Service Unavailable
    >>> main_content = find_main_content(user_browser.contents)
    >>> print main_content.findNext('p').renderContents()
    Translations for this release series are not available yet.

    >>> user_browser.handleErrors = False

Although, an administrator can see the same page.

    >>> admin_browser.open(
    ...     'http://translations.launchpad.dev/ubuntu/hoary/+lang/es')

Non existing languages are not viewable. English is a special case
in that we store the translatable messages as English, so it cannot
should not viewed

    >>> user_browser.open(
    ...     'http://translations.launchpad.dev/ubuntu/hoary/+lang/notexists')
    Traceback (most recent call last):
    ...
    NotFound: ...

    >>> user_browser.open(
    ...     'http://translations.launchpad.dev/ubuntu/hoary/+lang/en')
    Traceback (most recent call last):
    ...
    NotFound: ...

Translation pages for source packages are also unavailable to
non-administrative users.

    >>> user_browser.open(
    ...     'http://translations.launchpad.dev/ubuntu/hoary/+sources/evolution/'
    ...     '+pots/evolution-2.2')
    Traceback (most recent call last):
    ...
    TranslationUnavailable: ...

However, source package translations are still available to the
administrators.

    >>> admin_browser.open(
    ...     'http://translations.launchpad.dev/ubuntu/hoary/'
    ...     '+sources/evolution')

There is also an option to set/unset whether translation imports for a
distribution should be deferred. That option is set also from the same
form where we hide all translations and an admin is able to change it:

    >>> admin_browser.open('http://translations.launchpad.dev/ubuntu/hoary')
    >>> admin_browser.getLink('Change settings').click()
    >>> admin_browser.getControl(
    ...     'Defer translation imports').selected
    False
    >>> admin_browser.getControl(
    ...     'Defer translation imports').selected = True
    >>> admin_browser.getControl('Change').click()
    >>> print admin_browser.url
    http://translations.launchpad.dev/ubuntu/hoary

Once the system accepts the submission, we can see such change applied.

    >>> admin_browser.getLink('Change settings').click()
    >>> admin_browser.getControl(
    ...     'Defer translation imports').selected
    True

There are no visible user interface changes once this flag is changed. It
just prevents that the translation import script, which is executed by cron,
handle translation imports for this distro series.

== Translation focus ==

If translation focus is not set, there is no recommendation of what
release series should be translated.

    >>> login('admin@canonical.com')
    >>> distribution = factory.makeDistribution(name='earthian')
    >>> distroseries = factory.makeDistroRelease(
    ...     name='1.4', distribution=distribution)
    >>> logout()
    >>> print distribution.translation_focus
    None
    >>> admin_browser.open('http://translations.launchpad.dev/earthian/1.4')
    >>> print find_tag_by_id(admin_browser.contents, 'translation-focus')
    None

If focus is set, nice explanatory text is displayed.

    >>> login('admin@canonical.com')
    >>> focus_series = factory.makeDistroRelease(
    ...     name='1.6', distribution=distribution)
    >>> distribution.translation_focus = focus_series
    >>> logout()
    >>> admin_browser.open('http://translations.launchpad.dev/earthian/1.4')
    >>> print extract_text(
    ...     find_tag_by_id(admin_browser.contents, 'translation-focus'))
    Launchpad currently recommends translating 1.6.