~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
= Translation Access Display =

Ed Minh, an administrator, visits a translation page for Evolution.  The
page tells him what translation team is responsible for maintaining that
translation, and also reminds him that he has full editing privileges.

    >>> def print_tag(page, id):
    ...     """Find and print tag with given id."""
    ...     tag = find_tag_by_id(page, id)
    ...     if tag is None:
    ...         print 'None'
    ...     else:
    ...         print tag.renderContents()

    >>> admin_browser.open(
    ...     'http://translations.launchpad.dev/'
    ...     'evolution/trunk/+pots/evolution-2.2/es/+translate')
    >>> print_tag(admin_browser.contents, 'translation-managers')
    This translation is managed by ...testing Spanish team..., assigned
    by ...testing-translation-team</a>.

    >>> print_tag(admin_browser.contents, 'translation-access')
    You have full access to this translation.


== Displaying translation groups and reviewers ==

Evolution is part of the Gnome project, and when Gnome sets a
translation group of its own, that too is shown here.

    >>> import re

    >>> from canonical.database.constants import UTC_NOW
    >>> from canonical.launchpad.database.language import Language
    >>> from canonical.launchpad.database.person import Person
    >>> from canonical.launchpad.database.product import Product
    >>> from canonical.launchpad.database.translationgroup import (
    ...     TranslationGroup)
    >>> from canonical.launchpad.testing.factory import LaunchpadObjectFactory

    >>> factory = LaunchpadObjectFactory()
    >>> spanish = Language.selectOneBy(code='es')
    >>> evolution = Product.selectOneBy(name='evolution')
    >>> foobar = Person.selectOneBy(name='name16')
    >>> gnomegroup = TranslationGroup(name='gnomegroup',
    ...     title="Gnome translation group", summary="Testing group",
    ...     datecreated=UTC_NOW, owner=foobar)
    >>> evolution.project.translationgroup = gnomegroup

    >>> admin_browser.open(
    ...     'http://translations.launchpad.dev/'
    ...     'evolution/trunk/+pots/evolution-2.2/es/+translate')
    >>> print_tag(admin_browser.contents, 'translation-managers')
    This translation is managed by ...testing Spanish team..., assigned
    by ...testing-translation-team..., and translation group
    ...gnomegroup</a>.

If the two groups are identical, however, it is only listed once.

    >>> evolution.project.translationgroup = evolution.translationgroup

    >>> admin_browser.open(
    ...     'http://translations.launchpad.dev/'
    ...     'evolution/trunk/+pots/evolution-2.2/es/+translate')
    >>> managers_tag = find_tag_by_id(
    ...     admin_browser.contents, 'translation-managers').renderContents()
    >>> print re.search(',\s+and', managers_tag)
    None

If no translation group is assigned, the page also mentions that.

    >>> original_translation_group = evolution.translationgroup
    >>> evolution.translationgroup = None
    >>> evolution.project.translationgroup = None

    >>> admin_browser.open(
    ...     'http://translations.launchpad.dev/'
    ...     'evolution/trunk/+pots/evolution-2.2/es/+translate')
    >>> print_tag(admin_browser.contents, 'translation-managers')
    No translation group has been assigned.

    # Restore old situation.
    >>> evolution.translationgroup = original_translation_group


== Displaying access privileges ==

Ann Ominous is not logged in.  She visits the same translation and sees
the same information, except she's not allowed to enter anything.

    >>> anon_browser.open(
    ...     'http://translations.launchpad.dev/'
    ...     'evolution/trunk/+pots/evolution-2.2/es/+translate')
    >>> print_tag(anon_browser.contents, 'translation-managers')
    This translation is managed by ...testing Spanish team..., assigned
    by ...testing-translation-team</a>.

    >>> print_tag(anon_browser.contents, 'translation-access')
    You are not logged in.  Please log in to work on translations.

Joe Regular is logged in, but has no particular relationship to this
translation.  The page informs Joe that he can enter suggestions, which
will be held for review by the translation's managers.

    >>> user_browser.open(
    ...     'http://translations.launchpad.dev/'
    ...     'evolution/trunk/+pots/evolution-2.2/es/+translate')
    >>> print_tag(user_browser.contents, 'translation-access')
    Your suggestions will be held for review by the managers of this
    translation.

If Evolution's translation is set to Closed mode, Joe will not be able
to submit suggestions.

    >>> from canonical.launchpad.interfaces import TranslationPermission
    >>> evolution.translationpermission = TranslationPermission.CLOSED
    >>> user_browser.open(
    ...     'http://translations.launchpad.dev/'
    ...     'evolution/trunk/+pots/evolution-2.2/es/+translate')
    >>> print_tag(user_browser.contents, 'translation-access')
    This template can be translated only by its managers.

There is a special case where Joe visits a translation into a language
that isn't covered by the translation group: Joe is told he cannot enter
translations, and invited to contact the translation group about setting
up translation for this language.

    # XXX: JeroenVermeulen 2008-06-19 bug=197223: This test will work
    # once we stop inviting suggestions for untended Restricted
    # translations.

    #>>> evolution.translationpermission = TranslationPermission.RESTRICTED
    #>>> user_browser.open(
    #...     'http://translations.launchpad.dev/'
    #...     'evolution/trunk/+pots/evolution-2.2/nl/+translate')
    #>>> print_tag(user_browser.contents, 'translation-access')
    #There is nobody to manage translation into this particular language.
    #If you are interested in working on it, please contact the
    #translation group.

Finally, if there is no translation group at all and the permissions do
not allow Joe to translate, the page shows that the translation is
closed.

    >>> evolution.translationpermission = TranslationPermission.CLOSED
    >>> evolution.translationgroup = None
    >>> user_browser.open(
    ...     'http://translations.launchpad.dev/'
    ...     'evolution/trunk/+pots/evolution-2.2/es/+translate')
    >>> print_tag(user_browser.contents, 'translation-access')
    This translation is not open for changes.