l.t.i.w.IPOTemplate(IRosettaStats) : interface documentation

Part of lp.translations.interfaces.webservice View In Hierarchy

Known subclasses: lp.translations.browser.potemplate.IPOTemplateEditForm

A translation template.
Text header The standard template header in its native format.
Choice productseries Undocumented
Choice distroseries Undocumented
Choice sourcepackagename The source package that uses this template.
Int sourcepackagenameID The ID of the source package that uses this template.
Choice from_sourcepackagename The source package this template comes from (set it only if it's different from the previous 'Source Package Name'.
TextLine sourcepackageversion Undocumented
Object source_file Undocumented
Datetime datecreated Undocumented
Attribute translationgroups The ITranslationGroup objects that handle translations for this
Choice translationpermission The permission system which is used for this translation template.
Attribute relatives_by_source All IPOTemplate objects that have the same source.
TextLine displayname Undocumented
TextLine title Undocumented
Object product Undocumented
Object distribution Undocumented
Attribute translationtarget The direct object in which this template is attached.
Bool uses_english_msgids Some formats, such as Mozilla's XPI, use symbolic msgids where
Int translation_side Undocumented
Method __iter__ Return an iterator over current IPOTMsgSet in this template.
Method clearPOFileCache Clear POFile-related cached data.
Method setActive Toggle the iscurrent flag.
Method getHeader Return an ITranslationHeaderData representing its header.
Method getPOTMsgSetByMsgIDText Return IPOTMsgSet indexed by singular_text from this template.
Method getPOTMsgSetBySequence Return the IPOTMsgSet with the given sequence or None.
Method getPOTMsgSets Return an iterator over IPOTMsgSet objects in this template.
Method getTranslationCredits Return an iterator over translation credits.
Method getPOTMsgSetsCount Return the number of POTMsgSet objects related to this object.
Method __getitem__ Same as getPOTMsgSetByMsgIDText(), with only_current=True
Method sharingKey A key for determining the sharing precedence of a template.
Method getPOTMsgSetByID Return the POTMsgSet object related to this POTemplate with the id.
Method languages This Return the set of languages for which we have POFiles for
Method getPOFileByPath Get the PO file of the given path.
Method getPOFileByLang Get the PO file of the given language.
Method getOtherSidePOTemplate Get the POTemplate with the same name on the other side of a
Method hasPluralMessage Test whether this template has any message sets which are plural
Method export Return a serialized version as a string using its native format.
Method exportWithTranslations Return an ExportedTranslationFile using its native format.
Method expireAllMessages Mark all of our message sets as not current (sequence=0)
Method newPOFile Return a new IPOFile for the given language.
Method getDummyPOFile Return a DummyPOFile if there isn't already a persistent IPOFile
Method createPOTMsgSetFromMsgIDs Creates a new template message in the database.
Method createMessageSetFromText Creates a new template message in the database using strings.
Method getOrCreateSharedPOTMsgSet Finds an existing shared POTMsgSet to use or creates a new one.
Method importFromQueue Import given queue entry.
Method getTranslationRows Return the IVPOTexport objects for this template.
Method awardKarma Award karma for a translation action on this template.
Method getTranslationPolicy Return the applicable ITranslationPolicy object.

Inherited from IRosettaStats:

Method testStatistics Ensure that the statistics here are self-consistent.
Method updateStatistics Update the statistics associated with this object.
Method messageCount Return the number of current IPOMessageSets inside this object.
Method currentCount Return the number of current upstream translations.
Method updatesCount Return the number of msgsets newer in Rosetta.
Method newCount Return the number of newly translated messages in Rosetta.
Method rosettaCount Return the number of msgsets translated only in rosetta.
Method unreviewedCount Return the number of msgsets with unreviewed suggestions.
Method translatedCount Return the total number of msgsets that are translated in Rosetta.
Method untranslatedCount Return the number of msgsets that are untranslated.
Method updatesPercentage Return the percentage of updated msgsets inside this object.
Method currentPercentage Return the percentage of current msgsets inside this object.
Method rosettaPercentage Return the percentage of msgsets translated with Rosetta inside
Method translatedPercentage Return the percentage of msgsets translated for this object.
Method untranslatedPercentage Return the percentage of msgsets untranslated for this object.
Method newPercentage Return the percentage of translations for this object that are
header =
The standard template header in its native format.
productseries =
Undocumented
distroseries =
Undocumented
sourcepackagename =
The source package that uses this template.
sourcepackagenameID =
The ID of the source package that uses this template.
from_sourcepackagename =
The source package this template comes from (set it only if it's different from the previous 'Source Package Name'.
sourcepackageversion =
Undocumented
source_file =
Undocumented
datecreated =
Undocumented
translationgroups =
The ITranslationGroup objects that handle translations for this template. There can be several because they can be inherited from project to product, for example.
translationpermission =
The permission system which is used for this translation template. This is inherited from the product, project and/or distro in which the translation template is found.
relatives_by_source =
All IPOTemplate objects that have the same source. For example those that came from the same productseries or the same source package.
displayname =
Undocumented
title =
Undocumented
product =
Undocumented
distribution =
Undocumented
translationtarget =
The direct object in which this template is attached. This will either be an ISourcePackage or an IProductSeries.
uses_english_msgids =
Some formats, such as Mozilla's XPI, use symbolic msgids where gettext uses the original English strings to identify messages.
translation_side =
Undocumented
def __iter__():
Return an iterator over current IPOTMsgSet in this template.
def clearPOFileCache():
Clear POFile-related cached data.

As you work with a POTemplate, some data about its POFile`s gets cached. But if you're iterating over the template's translations one `POFile at a time, you can drop any cached data about a POFile as soon as you're done with it. Use this method to do that.

def setActive(active):
Toggle the iscurrent flag.

Takes care of updating the suggestive potempalte cache when the template is disabled.

def getHeader():
Return an ITranslationHeaderData representing its header.
def getPOTMsgSetByMsgIDText(singular_text, plural_text=None, only_current=False, context=None):
Return IPOTMsgSet indexed by singular_text from this template.

If the key is a string or a unicode object, returns the IPOTMsgSet in this template that has a primary message ID with the given text.

If only_current is True, then get only current message sets.

If context is not None, look for a message set with that context value.

If plural_text is not None, also filter by that plural text.

If no IPOTMsgSet is found, return None.

def getPOTMsgSetBySequence(sequence):
Return the IPOTMsgSet with the given sequence or None.

The sequence number must be > 0.

ParameterssequenceThe sequence number when the IPOTMsgSet appears.
def getPOTMsgSets(current=True, prefetch=True):
Return an iterator over `IPOTMsgSet` objects in this template.

:param current: Whether to limit the search to current
    POTMsgSets.
:param prefetch: Whether to prefetch the `POMsgID`s attached to
    the POTMsgSets.  This is for optimization only.
:return: All current POTMsgSets for the template if `current` is
    True, or all POTMsgSets for the template otherwise.
def getTranslationCredits():
Return an iterator over translation credits.

Return all IPOTMsgSet objects in this template that are translation credits.

def getPOTMsgSetsCount(current=True):
Return the number of POTMsgSet objects related to this object.

The current argument is used to select only current POTMsgSets or all of them.

def __getitem__(key):
Same as getPOTMsgSetByMsgIDText(), with only_current=True
def sharingKey():
A key for determining the sharing precedence of a template.

Active templates have precedence over inactive ones. Development foci have precendence over non-development foci. Product development foci have precedence over Package development foci.

def getPOTMsgSetByID(id):
Return the POTMsgSet object related to this POTemplate with the id.

If there is no POTMsgSet with that id and for that POTemplate, return None.

def languages():
This Return the set of languages for which we have POFiles for this POTemplate.
def getPOFileByPath(path):
Get the PO file of the given path.

Return None if there is no such IPOFile.

def getPOFileByLang(language_code):
Get the PO file of the given language.

Return None if there is no such POFile.

def getOtherSidePOTemplate():
Get the POTemplate with the same name on the other side of a packaging link.
def hasPluralMessage():
Test whether this template has any message sets which are plural message sets.
def export():
Return a serialized version as a string using its native format.
def exportWithTranslations():
Return an ExportedTranslationFile using its native format.

It include all translations available.

def expireAllMessages():
Mark all of our message sets as not current (sequence=0)
def newPOFile(language_code, create_sharing=True):
Return a new IPOFile for the given language.

Raise LanguageNotFound if the language does not exist in the database.

We should not have already an IPOFile for the given language_code.

Parameterslanguage_codeThe code of the language for which to create the IPOFile.
requesterThe requester person. If given and will have edit permissions on the IPOFile, it becomes the owner. Otherwise rosetta_experts own the file.
create_sharingWhether the IPOFile should be created in all sharing templates, too. Should only be set to False to avoid loops when creating a new IPOTemplate.
def getDummyPOFile(language, requester=None, check_for_existing=True):
Return a DummyPOFile if there isn't already a persistent IPOFile

Raise LanguageNotFound if the language does not exist in the database.

This method is designed to be used by read only actions. This way you only create a POFile when you actually need to store data.

We should not have already a POFile for the given language: if check_for_existing is set to False, no check will be done for this.

def createPOTMsgSetFromMsgIDs(msgid_singular, msgid_plural=None, context=None, sequence=0):
Creates a new template message in the database.
Parametersmsgid_singularA reference to a singular msgid.
msgid_pluralA reference to a plural msgid. Can be None if the message is not a plural message.
contextA context for the template message differentiating it from other template messages with exactly the same msgid.
sequenceThe sequence number of this POTMsgSet within this POTemplate. If 0, it is considered obsolete.
ReturnsThe newly created message set.
def createMessageSetFromText(singular_text, plural_text, context=None, sequence=0):
Creates a new template message in the database using strings.

Similar to createMessageSetFromMessageID, but takes text objects (unicode or string) along with textual context, rather than a message IDs.

Parameterssingular_textThe string for the singular msgid.
msgid_pluralThe string for the plural msgid. Must be None if the message is not a plural message.
contextA context for the template message differentiating it from other template messages with exactly the same msgid.
sequenceThe sequence number of this POTMsgSet within this POTemplate. If 0, it is considered obsolete.
ReturnsThe newly created message set.
def getOrCreateSharedPOTMsgSet(singular_text, plural_text, context=None, initial_file_references=None, initial_source_comment=None):
Finds an existing shared POTMsgSet to use or creates a new one.

:param singular_text: string containing singular form.
:param plural_text: string containing plural form.
:param context: context to differentiate between two messages with
same singular_text and plural_text.
:param initial_file_references: Initializer for file_references if
    a new POTMsgSet needs to be created.  Will not be set on an
    existing POTMsgSet.
:param initial_source_comment: Initializer for source_comment if
    a new POTMsgSet needs to be created.  Will not be set on an
    existing POTMsgSet.
:return: existing or new shared POTMsgSet with a sequence of 0
in this POTemplate.
def importFromQueue(entry_to_import, logger=None, txn=None):
Import given queue entry.
Parametersentry_to_importTranslationImportQueueEntry specifying an approved import for this POTemplate
loggeroptional logger to report problems to.
txnoptional transaction manager for intermediate commits. Used to prevent long-running transactions that can lead to deadlocks.
Returnsa tuple of the subject line and body for a notification email to be sent to the uploader.
def getTranslationRows():
Return the IVPOTexport objects for this template.
def awardKarma(person, action_name):
Award karma for a translation action on this template.
def getTranslationPolicy():
Return the applicable ITranslationPolicy object.

The returned object is either a Product or a Distribution.

API Documentation for Launchpad, generated by pydoctor at 2019-09-22 00:00:13.