l.t.m.t.TranslationImportQueueEntry(SQLBase) : class documentation

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

No class docstring
Method sourcepackage See ITranslationImportQueueEntry.
Method guessed_potemplate See ITranslationImportQueueEntry.
Method canAdmin See ITranslationImportQueueEntry.
Method canEdit See ITranslationImportQueueEntry.
Method canSetStatus See ITranslationImportQueueEntry.
Method setStatus See ITranslationImportQueueEntry.
Method setErrorOutput See ITranslationImportQueueEntry.
Method addWarningOutput See ITranslationImportQueueEntry.
Method import_into See ITranslationImportQueueEntry.
Method reportApprovalConflict Report an approval conflict.
Method matchPOTemplateByDomain Attempt to find the one matching template, by domain.
Method getGuessedPOFile See ITranslationImportQueueEntry.
Method getFileContent See ITranslationImportQueueEntry.
Method getTemplatesOnSameDirectory See ITranslationImportQueueEntry.
Method getElapsedTimeText See ITranslationImportQueue.
Method _guessed_potemplate_for_pofile_from_path Return an IPOTemplate that we think is related to this entry.
Method _guessed_pofile_from_path Return an IPOFile that we think is related to this entry.
Method _findCustomLanguageCode Find applicable custom language code, if any.
Method _guessLanguage See ITranslationImportQueueEntry.
Method _get_pofile_from_language Return an IPOFile for the given language and domain.
Method _guess_multiple_directories_with_pofile Return IPOFile that we think is related to this entry, or None.

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
@property
def sourcepackage(self):
See ITranslationImportQueueEntry.
@property
def guessed_potemplate(self):
See ITranslationImportQueueEntry.
@property
def _guessed_potemplate_for_pofile_from_path(self):
Return an `IPOTemplate` that we think is related to this entry.

We make this guess by matching the path of the queue entry with those
of the `IPOTemplate`s for the same product series, or for the same
distro series and source package name (whichever applies to this
request).

So if there is a candidate template in the same directory as the
request's translation file, and we find no other templates in the same
directory in the database, we have a winner.
@property
def _guessed_pofile_from_path(self):
Return an IPOFile that we think is related to this entry.

We get it based on the path it's stored or None.

def canAdmin(self, roles):
See ITranslationImportQueueEntry.
def canEdit(self, roles):
See ITranslationImportQueueEntry.
def canSetStatus(self, new_status, user):
See ITranslationImportQueueEntry.
def setStatus(self, new_status, user):
See ITranslationImportQueueEntry.
def setErrorOutput(self, output):
See ITranslationImportQueueEntry.
def addWarningOutput(self, output):
See ITranslationImportQueueEntry.
def _findCustomLanguageCode(self, language_code):
Find applicable custom language code, if any.
def _guessLanguage(self):
See ITranslationImportQueueEntry.
@property
def import_into(self):
See ITranslationImportQueueEntry.
def reportApprovalConflict(self, domain, templates_count, sample):
Report an approval conflict.
def matchPOTemplateByDomain(self, domain, sourcepackagename=None):
Attempt to find the one matching template, by domain.

Looks within the context of the queue entry. If multiple templates match, reports an approval conflict.

ParametersdomainTranslation domain to look for.
sourcepackagenameOptional SourcePackageName to look for. If not given, source package name is not considered in the search.
ReturnsA single POTemplate, or None.
def _get_pofile_from_language(self, lang_code, translation_domain, sourcepackagename=None):
Return an IPOFile for the given language and domain.
Parameterslang_codeThe language code we are interested on.
translation_domainThe translation domain for the given language.
sourcepackagenameThe ISourcePackageName that uses this translation or None if we don't know it.
def getGuessedPOFile(self):
See ITranslationImportQueueEntry.
def _guess_multiple_directories_with_pofile(self):
Return IPOFile that we think is related to this entry, or None.

Multi-directory tree layouts are non-standard layouts where the .pot file and its .po files are stored in different directories. We only know of this happening with gettext files.

The known layouts are:

DIRECTORY/TRANSLATION_DOMAIN.pot DIRECTORY/LANG_CODE/TRANSLATION_DOMAIN.po

or

DIRECTORY/TRANSLATION_DOMAIN.pot DIRECTORY/LANG_CODE/messages/TRANSLATION_DOMAIN.po

or

DIRECTORY/TRANSLATION_DOMAIN.pot DIRECTORY/LANG_CODE/LC_MESSAGES/TRANSLATION_DOMAIN.po

or

DIRECTORY/TRANSLATION_DOMAIN.pot DIRECTORY/LANG_CODE/LANG_CODE.po

where DIRECTORY would be any path, even '', LANG_CODE is a language code and TRANSLATION_DOMAIN the translation domain is the one used for that .po file.

If this isn't enough, there are some packages that have a non standard layout where the .pot files are stored inside the sourcepackage with the binaries that will use it and the translations are stored in external packages following the same language pack ideas that we use with Ubuntu.

This layout breaks completely Rosetta because we don't have a way to link the .po and .pot files coming from different packages. The solution we take is to look for the translation domain across the whole distro series. In the concrete case of KDE language packs, they have the sourcepackagename following the pattern 'kde-i18n-LANGCODE' (KDE3) or kde-l10n-LANGCODE (KDE4).

def getFileContent(self):
See ITranslationImportQueueEntry.
def getTemplatesOnSameDirectory(self):
See ITranslationImportQueueEntry.
def getElapsedTimeText(self):
See ITranslationImportQueue.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.