~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
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

# pylint: disable-msg=E0211,E0213

from zope.interface import (
    Attribute,
    Interface,
    )

from lp.translations.interfaces.rosettastats import IRosettaStats


__metaclass__ = type

__all__ = [
    'IDistroSeriesLanguage',
    'IDistroSeriesLanguageSet',
    ]

class IDistroSeriesLanguage(IRosettaStats):
    """A placeholder for the statistics in the translation of a
    distroseries into a language, for example, Ubuntu Hoary into French.
    This exists to cache stats, and be a useful object for traversal in
    Rosetta."""

    id = Attribute("A unique ID")

    language = Attribute("The language.")

    distroseries = Attribute("The distro series which has been "
        "translated.")

    dateupdated = Attribute("The date these statistics were last updated.")

    title = Attribute("The title.")

    pofiles = Attribute("The set of pofiles in this distroseries for this "
        "language. This includes only the real pofiles where translations "
        "exist.")

    contributor_count = Attribute("The number of contributors in total "
        "for this language in the distribution.")

    def updateStatistics(ztm):
        """Update all the Rosetta stats for this distro series language."""

    def getPOFilesFor(potemplates):
        """Return `POFile`s for each of `potemplates`, in the same order.

        For any `POTemplate` that does not have a translation to the
        required language, a `DummyPOFile` is provided.
        """


class IDistroSeriesLanguageSet(Interface):
    """The set of distroserieslanguages."""

    def getDummy(distroseries, language):
        """Return a new DummyDistroSeriesLanguage for the given
        distroseries and language.
        """