IRosettaStats current interface doesn't suit database/pofile.py very well

Bug #1420 reported by Christian Reis
2
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

The current IRosettaStats interface doesn't suit database/pofile.py very well. If you look at the POFile class, you'll see stuff like:

    def messageCount(self):
        """See IRosettaStats."""
        return self.potemplate.messageCount()

    def currentCount(self, language=None):
        """See IRosettaStats."""
        return self.currentcount

    def updatesCount(self, language=None):
        """See IRosettaStats."""
        return self.updatescount

    def rosettaCount(self, language=None):
        """See IRosettaStats."""
        return self.rosettacount

Apart from the inconsistency (and note also that messageCount is /not/ exported in the IRosettaStats interface, so I don't know what it's for) the unused language argument is pretty bogus.

SteveA suggests instead having a getStatsFor(lang) API that returns an IRosettaStats object. Carlos apparently concurs.

Dafydd Harries (daf)
Changed in rosetta:
status: New → Accepted
tags: added: tech-debt
Revision history for this message
Данило Шеган (danilo) wrote :

What we should do is to have:
 1. ITranslationStatistics providing statistical counts
 2. IHasTranslations which has a standard interface to get individual language ITranslationStatistics object

The problem is that we are (ab)using IRosettaStats to handle both (i.e. POTemplates and POFiles). In practice POTemplate seems to be the only class using it in the wrong way.

Changed in rosetta:
importance: Medium → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.