Fix the copying of translations from Alternate Translations
Needs ReviewPublic

Authored by adrianchavesfernandez on Oct 26 2019, 3:25 PM.

Details

Summary

Catalog::altTrans only returns entries when the source string of
the current catalog entry completely matches the source string
of a candidate alternate translation.

I believe it was because of this that the resulting AltTrans
instance was not assigned a source, and the Alternate Translation
dock did not show the (redundant) source strings of its entries
because the source string was not filled.

However, the source string of the AltTrans instances was taken
into account by the logic to copy the alternate translation into
the catalog translation field. This logic is shared with the
translation memory, which has entries with source strings
different from the source string of the current catalog entry.

This logic, assuming that the source string of alternate translations
was empty, was copying badly-built strings into the catalog entry
translation field.

To fix this, Catalog::altTrans now fills the source field of AltTrans
instances. The Alternate Translations dock code no longer checks whether
the source string is empty to determine whether to display it, and
it simply never displays source strings, which we can safely assume to
match the source string of the current catalog entry.

BUG 302841

Test Plan

Tested manually.

Diff Detail

Repository
R456 Lokalize
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 18198
Build 18216: arc lint + arc unit