l.t.b.t.CurrentTranslationMessageView(LaunchpadView) : class documentation

Part of lp.translations.browser.translationmessage View In Hierarchy

Known subclasses: lp.translations.browser.translationmessage.CurrentTranslationMessageZoomedView

Holds all data needed to show an ITranslationMessage.

This view class could be used directly or as part of the POFileView class in which case, we would have up to 100 instances of this class using the same information at self.form.

Method __init__ Primes the view with information that is gathered by a parent view.
Method initialize Undocumented
Method getOfficialTranslation Return current translation on either side for plural form 'index'.
Method getCurrentTranslation Return the current translation for the pluralform 'index'.
Method getOtherTranslation Return the other-side translation for the pluralform 'index'.
Method getSharedTranslation Return the shared translation for the pluralform 'index'.
Method getSubmittedTranslation Return the translation submitted for the pluralform 'index'.
Method is_plural Return whether there are plural forms.
Method message_must_be_hidden Whether this message must be hidden from anonymous viewers.
Method translation_credits Return automatically created translation if defined, or None.
Method singular_text Return the singular form prepared to render in a web page.
Method plural_text Return a plural form prepared to render in a web page.
Method text_has_tab Whether the text to translate contain tab chars.
Method text_has_newline Whether the text to translate contain newline chars.
Method text_has_leading_or_trailing_space Whether the text to translate contain leading/trailing spaces.
Method source_comment Return the source code comments for this ITranslationMessage.
Method comment Return the translator comments for this ITranslationMessage.
Method file_references Return the file references for this ITranslationMessage.
Method zoom_url Return the URL where we should from the zoom icon.
Method zoom_alt Undocumented
Method zoom_link_id Undocumented
Method zoom_icon Undocumented
Method max_entries Return the max number of entries to show as suggestions.
Method dismissable_class The class string for dismissable parts.
Method dismissable_class_other The class string for dismissable other translations.
Method _set_dismiss_flags Set dismissal flags.
Method _buildAllSuggestions Builds all suggestions and puts them into suggestions_block.
Method _buildTranslationMessageSuggestions Build filtered list of submissions to be shown in the view.
def __init__(self, current_translation_message, request, plural_indices_to_store, translations, force_suggestion, force_diverge, error, second_lang_code, form_is_writeable, pofile, can_edit):
Primes the view with information that is gathered by a parent view.
Parametersplural_indices_to_storeA dictionary that indicates whether the translation associated should be stored in our database or ignored. It's indexed by plural form.
translationsA dictionary indexed by plural form index; BaseTranslationView constructed it based on form-submitted translations.
force_suggestionShould this be a suggestion even for editors.
force_divergeShould this translation be diverged.
errorThe error related to self.context submission or None.
second_lang_codeThe result of submiting field.alternative_value.
form_is_writeableWhether the form should accept write operations
pofileThe POFile that's being displayed or edited.
can_editWhether the user has editing privileges on pofile.
def initialize(self):
Undocumented
def _set_dismiss_flags(self, local_suggestions, other):
Set dismissal flags.

The flags have been initialized to False in the constructor. This method activates the right ones.

Parameterslocal_suggestionsThe list of local suggestions.
otherThe translation on the other side for this message or None if there is no such translation.
def _buildAllSuggestions(self):

Builds all suggestions and puts them into suggestions_block.

This method does the ugly nitty gritty of making sure we don't display duplicated suggestions; this is done by checking the translation strings in each submission and grabbing only one submission per string.

The decreasing order of preference this method encodes is:
  • Non-active translations to this context and to the pofile from which this translation was imported (non_editor)
  • Active translations to other contexts (elsewhere)
  • Non-editor translations to other contexts (wiki)
def _buildTranslationMessageSuggestions(self, title, suggestions, index, legal_warning=False, local_to_pofile=False):
Build filtered list of submissions to be shown in the view.

title is the title for the suggestion type, suggestions is a list of suggestions, and index is the plural form.

def getOfficialTranslation(self, index, is_other=False, is_shared=False):
Return current translation on either side for plural form 'index'.
def getCurrentTranslation(self, index):
Return the current translation for the pluralform 'index'.
def getOtherTranslation(self, index):
Return the other-side translation for the pluralform 'index'.
def getSharedTranslation(self, index):
Return the shared translation for the pluralform 'index'.
def getSubmittedTranslation(self, index):
Return the translation submitted for the pluralform 'index'.
@cachedproperty
def is_plural(self):
Return whether there are plural forms.
@cachedproperty
def message_must_be_hidden(self):
Whether this message must be hidden from anonymous viewers.

Messages are always shown to logged-in users. However, messages that are likely to contain email addresses must not be shown to anonymous visitors in order to keep them out of search engines, spam lists etc.

@property
def translation_credits(self):
Return automatically created translation if defined, or None.
@property
def singular_text(self):
Return the singular form prepared to render in a web page.
@property
def plural_text(self):
Return a plural form prepared to render in a web page.

If there is no plural form, return None.

@property
def text_has_tab(self):
Whether the text to translate contain tab chars.
@property
def text_has_newline(self):
Whether the text to translate contain newline chars.
@property
def text_has_leading_or_trailing_space(self):
Whether the text to translate contain leading/trailing spaces.
@property
def source_comment(self):
Return the source code comments for this ITranslationMessage.
@property
def comment(self):
Return the translator comments for this ITranslationMessage.
@property
def file_references(self):
Return the file references for this ITranslationMessage.
@property
def zoom_url(self):
Return the URL where we should from the zoom icon.
@property
def zoom_alt(self):
Undocumented
@property
def zoom_link_id(self):
Undocumented
@property
def zoom_icon(self):
Undocumented
@property
def max_entries(self):
Return the max number of entries to show as suggestions.

If there is no limit, we return None.

@property
def dismissable_class(self):
The class string for dismissable parts.
@property
def dismissable_class_other(self):
The class string for dismissable other translations.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.