= 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. >>> 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. 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. >>> 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.