Part of lp.translations.browser.translationmessage View In Hierarchy
Known subclasses: lp.translations.browser.pofile.POFileTranslateView, lp.translations.browser.translationmessage.CurrentTranslationMessagePageView
Base class that implements a framework for modifying translations.
This class provides a basis for building a batched translation page. It relies on one or more subviews being used to actually display the translations and form elements. It processes the form submitted and constructs data which can be then fed back into the subviews.
The subviews must be (or behave like) CurrentTranslationMessageViews.
Method | label | The label will be used as the main page heading. |
Method | initialize | Undocumented |
Method | share_with_other_side | Should these translations be shared with the other side? |
Method | user_is_official_translator | Determine whether the current user is an official translator. |
Method | form_is_writeable | Whether the form should accept write operations. |
Method | _extractLockTimestamp | Extract the lock timestamp from the request. |
Method | _checkSubmitConditions | Verify that this submission is possible and valid. |
Method | _buildBatchNavigator | Construct a BatchNavigator of POTMsgSets and return it. |
Method | _initializeTranslationMessageViews | Construct subviews as necessary. |
Method | _submitTranslations | Handle translations submitted via a form. |
Method | _receiveTranslations | Process and store submitted translations for potmsgset . |
Method | _storeTranslations | Store the translation submitted for a POTMsgSet. |
Method | _approveTranslation | Approve message . |
Method | _areSuggestionsEmpty | Return true if all suggestions are empty strings or None. |
Method | _prepareView | Collect data and build a TranslationMessageView for display. |
Method | _initializeAltLanguage | Initialize the alternative language widget and check form data. |
Method | _extractFormPostedTranslations | Look for translations for this POTMsgSet in the form submitted. |
Method | _observeTranslationUpdate | Observe that a translation was updated for the potmsgset. |
Method | _buildRedirectParams | Construct parameters for redirection. |
Method | _redirect | Redirect to the given url adding the selected filtering rules. |
Method | _redirectToNextPage | After a successful submission, redirect to the next batch page. |
The lock_timestamp is used to detect conflicting concurrent translation updates: if the translation that is being changed has been set after the current form was generated, the user chose a translation based on outdated information. In that case there is a conflict.
Raises | UnexpectedFormData if conditions are not met. In
principle the user should not have been given the option to
submit the current request. |
Return True if processing went fine; return False if errors occurred.
Implementing this method is complicated. It needs to find out what TranslationMessage were updated in the form post, call _receiveTranslations() for each of those, check for errors that may have occurred during that (displaying them using addErrorNotification), and otherwise call _redirectToNextPage if everything went fine.
potmsgset
.Returns | An error string in case of failure, or None otherwise. |
Raises | GettextValidationError | if the submitted translation fails gettext validation. The translation is not stored. |
TranslationConflict | if the current translations have changed since the translator/reviewer last saw them. The submitted translations are stored as suggestions. |
TranslationMessageView
for display.POTMsgSet
in the form submitted.
Store the new translations at self.form_posted_translations and its
fuzzy status at self.form_posted_needsreview, keyed on the
POTMsgSet
.
In this method, we look for various keys in the form, and use them as follows:
TranslationMessage.makeHTMLID
.In all those form keys, 'ID' is the ID of the POTMsgSet
.
Subclasses should redefine this method if they need to watch the
successful calls to potmsgset.updateTranslation
.
Redefine this method if you have additional parameters to preserve.