Part of lp.translations.model.potmsgset View In Hierarchy
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 |
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.
IPOTMsgSet
.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.
Parameters | suggested_languages | Languages that suggestions should be found for. |
used_languages | Languages that used messages should be found for. |
IPOTMsgSet
.translations
.pofile
.
The returned message matches exactly the given translations
strings (except plural forms not supported by pofile
, which
are ignored in the comparison).
Parameters | translations | A dict mapping plural forms to translation strings. |
prefer_shared | Whether to prefer a shared match over a diverged one. |
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.
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.
Parameters | currentmessage | The TranslationMessage that is current
now. This is where we'll see any conflicting changes
reflected in the date_reviewed timestamp. |
lock_timestamp | The timestamp of the translation state that the change is based on. | |
potranslations | POTranslation`s dict for the new
translation. If these are given, and identical to those of
`current_message , there is no conflict. |
If a translation conflict is detected, TranslationConflict is raised.
This is used in navigating the decision matrix in
setCurrentTranslation
.
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.
Parameters | pofile | The POFile that the suggestion is being approved for. |
suggestion | The TranslationMessage being approved. | |
reviewer | The Person responsible for approving the
suggestion. | |
share_with_other_side | Policy selector: share this change with the other translation side if possible? | |
lock_timestamp | Timestamp of the original translation state that this change is based on. |
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.
Parameters | pofile | The POFile that the suggestion is being approved for. |
suggestion | The TranslationMessage being approved. | |
share_with_other_side | Policy selector: share this change with the other translation side if possible? | |
lock_timestamp | Timestamp of the original translation state that this change is based on. |
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.
Parameters | pofile | The POFile that the suggestion is being approved for. |
suggestion | The TranslationMessage being approved. | |
lock_timestamp | Timestamp of the original translation state that this change is based on. |
TranslationMessage
.
The message is not made current; the caller must do so in order to keep the message in a consistent state.
IPOTMsgSet
.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.
IPOTMsgSet
.IPOTMsgSet
.