l.t.i.p.IPOTMsgSet(Interface) : interface documentation

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

A collection of message IDs.
Int id Undocumented
Text context Undocumented
Object msgid_singular A message ID along with the context uniquely identifies the
Object msgid_plural Undocumented
Attribute commenttext The manual comments this set has.
Attribute filereferences The files where this set appears.
Attribute sourcecomment The source code comments this set has.
Attribute flagscomment The flags this set has.
Attribute flags List of flags that apply to this message.
Text singular_text Undocumented
Text plural_text Undocumented
Bool uses_english_msgids Some formats, such as Mozilla's XPI, use symbolic msgids where
List credits_message_ids This class attribute is intended to be used to construct database
Method clone Return a new copy of this POTMsgSet.
Method getCurrentTranslationMessageOrDummy Return the current TranslationMessage, or a dummy.
Method getOtherTranslation Returns the TranslationMessage that is current on the other side.
Method getSharedTranslation Returns a shared TranslationMessage.
Method getLocalTranslationMessages Return all local unused translation messages for the POTMsgSet.
Method getExternallyUsedTranslationMessages Find externally used translations for the same message.
Method getExternallySuggestedTranslationMessages Find externally suggested translations for the same message.
Method getExternallySuggestedOrUsedTranslationMessages Find externally suggested/used translations for the same message.
Method hasTranslationChangedInLaunchpad Whether an imported translation differs from the current one.
Method isTranslationNewerThan Whether a current translation is newer than the timestamp.
Method validateTranslations Validate translations against gettext.
Method submitSuggestion Submit a suggested translation for this message.
Method dismissAllSuggestions Dismiss all suggestions for the given pofile.
Method getCurrentTranslation Get a current translation message.
Method setCurrentTranslation Set the message's translation in Ubuntu, or upstream, or both.
Method resetCurrentTranslation Turn the current translation back into a suggestion.
Method clearCurrentTranslation Set the current message in pofile to be untranslated.
Attribute hide_translations_from_anonymous Whether the translations for this message should be hidden.
Attribute is_translation_credit Whether this is a message set for crediting translators.
Choice translation_credits_type Undocumented
Method makeHTMLID Unique name for this POTMsgSet for use in HTML element ids.
Method updatePluralForm Update plural form text for this message.
Method getSequence Return the sequence number for this potmsgset in potemplate.
Method setSequence Set the sequence number for this potmsgset in potemplate.
Method setTranslationCreditsToTranslated Set the current translation for this translation credits message.
Method getAllTranslationMessages Retrieve all TranslationMessage`s for this `POTMsgSet.
Method getAllTranslationTemplateItems Retrieve all TranslationTemplateItem`s for this `POTMsgSet.
id =
Undocumented
context =
Undocumented
msgid_singular =
A message ID along with the context uniquely identifies the template message.
msgid_plural =
Undocumented
commenttext =
The manual comments this set has.
filereferences =
The files where this set appears.
sourcecomment =
The source code comments this set has.
flagscomment =
The flags this set has.
flags =
List of flags that apply to this message.
singular_text =
Undocumented
plural_text =
Undocumented
uses_english_msgids =
Some formats, such as Mozilla's XPI, use symbolic msgids where gettext uses the original English strings to identify messages.
credits_message_ids =
This class attribute is intended to be used to construct database queries that search for credits messages.
def clone():
Return a new copy of this POTMsgSet.
def getCurrentTranslationMessageOrDummy(pofile):
Return the current TranslationMessage, or a dummy.
ParameterspofilePO template you want a translation message for.
ReturnsThe current translation for self in pofile, if there is one. Otherwise, a DummyTranslationMessage for self in pofile.
def getOtherTranslation(language, side):
Returns the TranslationMessage that is current on the other side.
ParameterslanguageThe language in which to find the message.
sideThe side from which this message is seen.
def getSharedTranslation(language, side):
Returns a shared TranslationMessage.
ParameterslanguageThe language in which to find the message.
sideThe side from which this message is seen.
def getLocalTranslationMessages(potemplate, language, include_dismissed=False, include_unreviewed=True):
Return all local unused translation messages for the POTMsgSet.

Unused are those which are not current or imported, and local are those which are directly attached to this POTMsgSet.

Parameterslanguagelanguage we want translations for.
include_dismissedAlso return those translation messages that have a creation date older than the review date of the current message (== have been dismissed).
include_unreviewedAlso return those translation messages that have a creation date newer than the review date of the current message (== that are unreviewed). This is the default.
def getExternallyUsedTranslationMessages(language):
Find externally used translations for the same message.

This is used to find suggestions for translating this POTMsgSet that are actually used (i.e. current or imported) in other templates.

The suggestions are read-only; they come from the slave store.

Parameterslanguagelanguage we want translations for.
def getExternallySuggestedTranslationMessages(language):
Find externally suggested translations for the same message.

This is used to find suggestions for translating this POTMsgSet that were entered in another context, but for the same English text, and are not in actual use.

The suggestions are read-only; they come from the slave store.

Parameterslanguagelanguage we want translations for.
def getExternallySuggestedOrUsedTranslationMessages(suggested_languages=(), used_languages=()):
Find externally suggested/used translations for the same message.

This returns a mapping: language -> namedtuple (suggested, used) containing the results of self.getExternallySuggestedTranslationMessages and self.getExternallyUsedTranslationMessages for each language.

Parameterssuggested_languageslanguages we want suggestions for.
used_languageslanguges we want used messages for.
def hasTranslationChangedInLaunchpad(potemplate, language):
Whether an imported translation differs from the current one.

There has to be an imported translation: if there isn't, this is not a 'changed' translation, just a 'new' translation in Launchpad.

Parameterspotemplatepotemplate we are asking about.
languagelanguage for which translations we are asking about.
def isTranslationNewerThan(pofile, timestamp):
Whether a current translation is newer than the timestamp.

Returns True if there is a current and newer translation, and False otherwise.

Parameterspofiletranslation file for which translations we are asking about.
timestampa timestamp we are comparing to.
def validateTranslations(translations):
Validate translations against gettext.
ParameterstranslationsA dict mapping plural forms to translated strings.
RaisesGettextValidationErrorif there is a problem with the translations.
def submitSuggestion(pofile, submitter, new_translations, from_import=False):
Submit a suggested translation for this message.

If an identical message is already present, it will be returned (and it is not changed). Otherwise, a new one is created and returned. Suggestions for translation credits messages are ignored, and None is returned in that case. Setting from_import to true will prevent karma assignment and set the origin of the created message to SCM instead of ROSETTAWEB.

def dismissAllSuggestions(pofile, reviewer, lock_timestamp):
Dismiss all suggestions for the given pofile.

If a translation conflict is detected, TranslationConflict is raised.

Parameterspofilea POFile to dismiss suggestions from.
reviewerthe person that is doing the dismissal.
lock_timestampthe timestamp when we checked the values we want to update.
def getCurrentTranslation(potemplate, language, side):
Get a current translation message.
ParameterspotemplateAn IPOTemplate to look up a translation for. If it's None, ignore diverged translations.
languagetranslation should be to this ILanguage.
sidetranslation side to look at. (A TranslationSide value)
def setCurrentTranslation(pofile, submitter, translations, origin, share_with_other_side=False, lock_timestamp=None):
Set the message's translation in Ubuntu, or upstream, or both.
ParameterspofilePOFile you're setting translations in. Other POFiles that share translations with this one may also be affected.
submitterPerson who is setting these translations.
translationsa dict mapping plural-form numbers to the translated string for that form.
originA RosettaTranslationOrigin.
share_with_other_sideWhen sharing this translation, share it with the other TranslationSide as well.
lock_timestampTimestamp of the original translation state that this change is based on.
def resetCurrentTranslation(pofile, lock_timestamp=None, share_with_other_side=False):
Turn the current translation back into a suggestion.

This deactivates the message's current translation. The message becomes untranslated or, if it was diverged, reverts to its shared translation.

The previously current translation becomes visible as a new suggestion again, as do all suggestions that came after it.

ParameterspofileThe POFile to make the change in.
lock_timestampTimestamp of the original translation state that this change is based on.
share_with_other_sideMake the same change on the other translation side.
def clearCurrentTranslation(pofile, submitter, origin, share_with_other_side=False, lock_timestamp=None):
Set the current message in pofile to be untranslated.

If the current message is shared, this will also clear it in other translations that share the same message.

ParameterspofileThe translation file that should have its current translation for this POTMsgSet cleared. If the message is shared, this may not be the only translation file that will be affected.
submitterThe person responsible for clearing the message.
originRosettaTranslationOrigin.
share_with_other_sideIf the current message is also current on the other side (i.e. the Ubuntu side if working upstream, or vice versa) then should it be cleared there as well?
lock_timestampTimestamp of the original translation state that this change is based on.
hide_translations_from_anonymous =
Whether the translations for this message should be hidden.

Messages that are likely to contain email addresses are shown only to logged-in users, and not to anonymous users.

is_translation_credit =
Whether this is a message set for crediting translators.
translation_credits_type =
Undocumented
def makeHTMLID(suffix=None):

Unique name for this POTMsgSet for use in HTML element ids.

The name is an underscore-separated sequence of:
  • the string 'msgset'
  • unpadded, numerical id
  • optional caller-supplied suffix.
Parameterssuffixan optional suffix to be appended. Must be suitable for use in HTML element ids.
def updatePluralForm(plural_form_text):
Update plural form text for this message.
Parametersplural_form_textUnicode string representing the plural form we want to store or None to unset current plural form.
def getSequence(potemplate):
Return the sequence number for this potmsgset in potemplate.
ParameterspotemplateIPOTemplate where the sequence number applies.
def setSequence(potemplate, sequence):
Set the sequence number for this potmsgset in potemplate.
ParameterspotemplateIPOTemplate where the sequence number applies.
sequenceThe sequence number of this IPOTMsgSet in the given IPOTemplate.
def setTranslationCreditsToTranslated(pofile):
Set the current translation for this translation credits message.

Sets a fixed dummy string as the current translation, if this is a translation credits message, so that these get counted as 'translated', too. Credits messages that already have a translation, imported messages and normal messages are left untouched. :param pofile: the POFile to set this translation in.

def getAllTranslationMessages():
Retrieve all TranslationMessage`s for this `POTMsgSet.
def getAllTranslationTemplateItems():
Retrieve all TranslationTemplateItem`s for this `POTMsgSet.
API Documentation for Launchpad, generated by pydoctor at 2019-09-18 00:00:08.