l.t.m.p.POTMsgSet(SQLBase) : class documentation

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

No class docstring
Method clone Undocumented
Method uses_english_msgids See IPOTMsgSet.
Method singular_text See IPOTMsgSet.
Method plural_text See IPOTMsgSet.
Method getCurrentTranslationMessageOrDummy See IPOTMsgSet.
Method getOtherTranslation See IPOTMsgSet.
Method getSharedTranslation See IPOTMsgSet.
Method getCurrentTranslation See IPOTMsgSet.
Method getLocalTranslationMessages See IPOTMsgSet.
Method getExternallyUsedTranslationMessages See IPOTMsgSet.
Method getExternallySuggestedTranslationMessages See IPOTMsgSet.
Method getExternallySuggestedOrUsedTranslationMessages See IPOTMsgSet.
Method flags Undocumented
Method hasTranslationChangedInLaunchpad See IPOTMsgSet.
Method isTranslationNewerThan See IPOTMsgSet.
Method validateTranslations See IPOTMsgSet.
Method findTranslationMessage Find the best matching message in this pofile.
Method submitSuggestion See IPOTMsgSet.
Method dismissAllSuggestions See IPOTMsgSet.
Method approveSuggestion Approve a suggestion.
Method acceptFromImport Accept a suggestion coming from a translation import.
Method acceptFromUpstreamImportOnPackage Accept a suggestion coming from a translation import.
Method approveAsDiverged Approve a suggestion to become a diverged translation.
Method setCurrentTranslation See IPOTMsgSet.
Method resetCurrentTranslation See IPOTMsgSet.
Method clearCurrentTranslation See IPOTMsgSet.
Method hide_translations_from_anonymous See IPOTMsgSet.
Method is_translation_credit See IPOTMsgSet.
Method translation_credits_type See IPOTMsgSet.
Method makeHTMLID See IPOTMsgSet.
Method updatePluralForm See IPOTMsgSet.
Method setTranslationCreditsToTranslated See IPOTMsgSet.
Method setSequence See IPOTMsgSet.
Method getSequence See IPOTMsgSet.
Method getAllTranslationMessages See IPOTMsgSet.
Method getAllTranslationTemplateItems See IPOTMsgSet.
Method _conflictsExistingSourceFileFormats Return whether source_file_format conflicts with existing ones
Method _getExternalTranslationMessages Return external suggestions for this message.
Method _findPOTranslations Find all POTranslation records for passed translations.
Method _findMatchingTranslationMessage Find the best matching message in this pofile.
Method _checkForConflict Check message for conflicting changes since lock_timestamp.
Method _maybeRaiseTranslationConflict Checks if there is a translation conflict for the message.
Method _nameMessageStatus Figure out the decision-matrix status of a message.
Method _makeTranslationMessage Create a new TranslationMessage.
Method _cloneAndDiverge Create a diverged clone of a TranslationMessage.
Method _setTranslation Set the current translation.

Inherited from SQLBase:

Method __init__ Extended version of the SQLObjectBase constructor.
Method __repr__ Undocumented
Method destroySelf Undocumented
Method __eq__ Equality operator.
Method __ne__ Inverse of __eq__.
Method __storm_invalidated__ Flush cached properties.
Class Method _get_store Undocumented
def clone(self):
Undocumented
def _conflictsExistingSourceFileFormats(self, source_file_format=None):
Return whether source_file_format conflicts with existing ones for this POTMsgSet.

If source_file_format is None, just check the overall consistency of all the source_file_format values. Otherwise, it should be a TranslationFileFormat value.

@property
def uses_english_msgids(self):
See IPOTMsgSet.
@property
def singular_text(self):
See IPOTMsgSet.
@property
def plural_text(self):
See IPOTMsgSet.
def getCurrentTranslationMessageOrDummy(self, pofile):
See IPOTMsgSet.
def getOtherTranslation(self, language, side):
See IPOTMsgSet.
def getSharedTranslation(self, language, side):
See IPOTMsgSet.
def getCurrentTranslation(self, potemplate, language, side):
See IPOTMsgSet.
def getLocalTranslationMessages(self, potemplate, language, include_dismissed=False, include_unreviewed=True):
See IPOTMsgSet.
def _getExternalTranslationMessages(self, suggested_languages=(), used_languages=()):
Return external suggestions for this message.

External suggestions are all TranslationMessages for the same english string which are used or suggested in other templates.

A message is used if it's either imported or current, and unused otherwise.

Suggestions are read-only, so these objects come from the slave store.

Parameterssuggested_languagesLanguages that suggestions should be found for.
used_languagesLanguages that used messages should be found for.
def getExternallyUsedTranslationMessages(self, language):
See IPOTMsgSet.
def getExternallySuggestedTranslationMessages(self, language):
See IPOTMsgSet.
def getExternallySuggestedOrUsedTranslationMessages(self, suggested_languages=(), used_languages=()):
See IPOTMsgSet.
@property
def flags(self):
Undocumented
def hasTranslationChangedInLaunchpad(self, potemplate, language):
See IPOTMsgSet.
def isTranslationNewerThan(self, pofile, timestamp):
See IPOTMsgSet.
def validateTranslations(self, translations):
See IPOTMsgSet.
def _findPOTranslations(self, translations):
Find all POTranslation records for passed translations.
def findTranslationMessage(self, pofile, translations=None, prefer_shared=False):
Find the best matching message in this pofile.

The returned message matches exactly the given translations strings (except plural forms not supported by pofile, which are ignored in the comparison).

ParameterstranslationsA dict mapping plural forms to translation strings.
prefer_sharedWhether to prefer a shared match over a diverged one.
def _findMatchingTranslationMessage(self, pofile, potranslations, prefer_shared=False):
Find the best matching message in this `pofile`.

:param pofile: The `POFile` to look in.
:param potranslations: a list of `POTranslation`s.  Forms that
    are not translated should have None instead.
:param prefer_shared: Whether to prefer a shared match over a
    diverged one.
def submitSuggestion(self, pofile, submitter, new_translations, from_import=False):
See IPOTMsgSet.
def _checkForConflict(self, current_message, lock_timestamp, potranslations=None):
Check message for conflicting changes since lock_timestamp.

Call this before changing this message's translations, to ensure that a read-modify-write operation on a message does not accidentally overwrite newer changes based on older information.

One example of a read-modify-write operation is: user downloads translation file, translates a message, then re-uploads. Another is: user looks at a message in the web UI, decides that neither the current translation nor any of the suggestions are right, and clears the message.

In these scenarios, it's possible for someone else to come along and change the message's translation between the time we provide the user with a view of the current state and the time we receive a change from the user. We call this a conflict.

Raises TranslationConflict if a conflict exists.

ParameterscurrentmessageThe TranslationMessage that is current now. This is where we'll see any conflicting changes reflected in the date_reviewed timestamp.
lock_timestampThe timestamp of the translation state that the change is based on.
potranslationsPOTranslation`s dict for the new translation. If these are given, and identical to those of `current_message, there is no conflict.
def _maybeRaiseTranslationConflict(self, message, lock_timestamp):
Checks if there is a translation conflict for the message.

If a translation conflict is detected, TranslationConflict is raised.

def dismissAllSuggestions(self, pofile, reviewer, lock_timestamp):
See IPOTMsgSet.
def _nameMessageStatus(self, message, translation_side_traits):
Figure out the decision-matrix status of a message.

This is used in navigating the decision matrix in setCurrentTranslation.

def _makeTranslationMessage(self, pofile, submitter, translations, origin, diverged=False):
Create a new TranslationMessage.

The message will not be made current on either side (Ubuntu or upstream), but it can be diverged. Only messages that are current should be diverged, but it's up to the caller to ensure the right state.

def approveSuggestion(self, pofile, suggestion, reviewer, share_with_other_side=False, lock_timestamp=None):
Approve a suggestion.
ParameterspofileThe POFile that the suggestion is being approved for.
suggestionThe TranslationMessage being approved.
reviewerThe Person responsible for approving the suggestion.
share_with_other_sidePolicy selector: share this change with the other translation side if possible?
lock_timestampTimestamp of the original translation state that this change is based on.
def acceptFromImport(self, pofile, suggestion, share_with_other_side=False, lock_timestamp=None):
Accept a suggestion coming from a translation import.

When importing translations, these are first added as a suggestion and only after successful validation they are made current. This is slightly different to approving a suggestion because no reviewer is credited.

ParameterspofileThe POFile that the suggestion is being approved for.
suggestionThe TranslationMessage being approved.
share_with_other_sidePolicy selector: share this change with the other translation side if possible?
lock_timestampTimestamp of the original translation state that this change is based on.
def acceptFromUpstreamImportOnPackage(self, pofile, suggestion, lock_timestamp=None):
Accept a suggestion coming from a translation import.

This method allow to store translation as upstream translation even though there is no upstream template. It is similar to acceptFromImport but will make sure not to overwrite existing translations. Rather, it will mark the translation as being current in upstream.

ParameterspofileThe POFile that the suggestion is being approved for.
suggestionThe TranslationMessage being approved.
lock_timestampTimestamp of the original translation state that this change is based on.
def _cloneAndDiverge(self, original_message, pofile):
Create a diverged clone of a TranslationMessage.

The message is not made current; the caller must do so in order to keep the message in a consistent state.

def approveAsDiverged(self, pofile, suggestion, reviewer, lock_timestamp=None):
Approve a suggestion to become a diverged translation.
def setCurrentTranslation(self, pofile, submitter, translations, origin, share_with_other_side=False, lock_timestamp=None):
See IPOTMsgSet.
def _setTranslation(self, pofile, submitter, origin, potranslations, identical_message=None, share_with_other_side=False, lock_timestamp=None):
Set the current translation.

https://dev.launchpad.net/Translations/Specs/setCurrentTranslation

:param pofile: The `POFile` to set the translation in.
:param submitter: The `Person` who produced this translation.
:param origin: The translation's `RosettaTranslationOrigin`.
:param potranslations: A dict mapping plural-form numbers to the
    respective `POTranslation`s for those forms.
:param identical_message: The already existing message, if any,
    that's either shared or diverged for `pofile.potemplate`,
    whose translations are identical to the ones we're setting.
:param share_with_other_side: Propagate this change to the other
    translation side if appropriate.
:param lock_timestamp: The timestamp of the translation state
    that the change is based on.
:return: The `TranslationMessage` that is current after
    completion.
def resetCurrentTranslation(self, pofile, lock_timestamp=None, share_with_other_side=False):
See IPOTMsgSet.
def clearCurrentTranslation(self, pofile, submitter, origin, share_with_other_side=False, lock_timestamp=None):
See IPOTMsgSet.
@property
def hide_translations_from_anonymous(self):
See IPOTMsgSet.
@property
def is_translation_credit(self):
See IPOTMsgSet.
@property
def translation_credits_type(self):
See IPOTMsgSet.
def makeHTMLID(self, suffix=None):
See IPOTMsgSet.
def updatePluralForm(self, plural_form_text):
See IPOTMsgSet.
def setTranslationCreditsToTranslated(self, pofile):
See IPOTMsgSet.
def setSequence(self, potemplate, sequence):
See IPOTMsgSet.
def getSequence(self, potemplate):
See IPOTMsgSet.
def getAllTranslationMessages(self):
See IPOTMsgSet.
def getAllTranslationTemplateItems(self):
See IPOTMsgSet.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.