Part of lp.translations.utilities.translationmerger View In Hierarchy
Static Method | findMergeablePackagings | Find packagings where both product and package have templates. |
Class Method | mergePackagingTemplates | Undocumented |
Class Method | mergeModifiedTemplates | Undocumented |
Method | mergeAll | Properly merge POTMsgSets and TranslationMessages. |
Method | __init__ | Constructor. |
Method | mergePOTMsgSets | Merge POTMsgSets for given sequence of sharing templates. |
Method | mergeTranslationMessages | Share `TranslationMessage`s between templates where possible. |
Class Method | _mergeTemplates | Undocumented |
Method | _removeDuplicateMessages | Get rid of duplicate TranslationMessages where needed. |
Method | _mapRepresentatives | Map out POTMsgSets' subordinates and templates. |
Static Method | _getPOTMsgSetIds | Get list of ids for `template`'s `POTMsgSet`s. |
Static Method | _getPOTMsgSetTranslationMessageKey | Return tuple that identifies a TranslationMessage in a POTMsgSet. |
Static Method | _partitionTranslationMessageIds | Partition `TranslationMessage`s by language. |
Method | _scrubPOTMsgSetTranslations | Map out translations for potmsgset , and eliminate duplicates. |
Static Method | _findClashes | What would clash if we moved message to the target environment? |
Method | _saveByDiverging | Avoid a TranslationMessage clash during POTMsgSet merge. |
Class Method | _divergeTo | Attempt to save message by diverging to target_potemplate . |
Parameters | potemplates | The templates to merge across. |
Returns | A tuple of dicts. The first maps each POTMsgSet 's
key (as returned by get_potmsgset_key ) to a list of its
subordinate POTMsgSet`s. The second maps each
representative `POTMsgSet to its representative
POTemplate . |
A TranslationMessage is identified by (potemplate, potmsgset, language, msgstr0, ...). In this case we leave out the potmsgset (because we start out with one) and potemplate (because that's sorted out in the nested dicts).
Partition `TranslationMessage`s by language. Only the ids are stored, not the `TranslationMessage` objects themselves, so as to avoid pinning the objects in memory. :param potmsgset: A `POTMsgSet`. All its `TranslationMessage`s will be read and partitioned. :return: A list of lists of `TranslationMessage` ids. Each of the inner lists represents one language.
potmsgset
, and eliminate duplicates.
In the transition period for message sharing, there may be duplicate TranslationMessages that may upset assumptions in the code. Clean those up.
message
to the target environment?
A clash can be either message
being current when the target
environment already has a current message for that language, or
similar for the message being imported.
Returns | a tuple of a clashing ubuntu message or None, a clashing upstream message or None, and a message that is identical to the one you passed in, if present. |
The clash in this case is that we're trying to move message
into a target environment (POTMsgSet and either POTemplate or
shared status) that already has a current/imported message.
This function tries to preserve the message for its original environment by making it diverged. If successful, the message will become a diverged one for one POTemplate that source_potmsgset is linked to, preferring the one it was linked to first.
message
by diverging to target_potemplate
.Parameters | message | a TranslationMessage to save by diverging. |
target_potmsgset | the POTMsgSet that message is to be
attached to. | |
target_potemplate | a POTemplate that the message might be able to diverge to. | |
Returns | whether a solution was found for this message. If
True, you're done with message . If False, you'll have to
find another place for it. |