launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02565
[Merge] lp:~adeuring/launchpad/bug-702468 into lp:launchpad
Abel Deuring has proposed merging lp:~adeuring/launchpad/bug-702468 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#702468 First upstream translation does not replace Ubuntu-only translation
https://bugs.launchpad.net/bugs/702468
For more details, see:
https://code.launchpad.net/~adeuring/launchpad/bug-702468/+merge/49205
This branch fixes bug 702468: First upstream translation does not replace Ubuntu-only translation.
The flags TranslationMessage.is_current_(upstream|ubuntu) are set in
POTMsgSet._setTranslation().
The bug describes the situation that we have no incumbent message
and the "twin" message (i.e. the new message) is either shared
or diverged but not shared with the other side. The decision_matrix
entries for these cases are
decision_matrix['incumbent_none']['twin_shared'] and
decision_matrix['incumbent_none']['twin_diverged'], respectively.
The treatment of the translation on the "other side" for these cases
is described by the "decision character" '*', so this branch changes
the "elif character == '*':" part of the the method _setTranslation().
The "decision character" '*' is also used in
decision_matrix['incumbent_shared'], but the "elif incumbent_message
is None:" in my patch ensures that the method behaves as before in
this case.
The existing tests in test_setcurrenttranslation.py covered the
case "existing translation in Ubuntu, no translation in upstream"
already, so I only changed the expected data for the two "relevant"
tests.
test: ./bin/test -vvt lp.translations.tests.test_setcurrenttranslation
no lint
--
https://code.launchpad.net/~adeuring/launchpad/bug-702468/+merge/49205
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~adeuring/launchpad/bug-702468 into lp:launchpad.
=== modified file 'lib/lp/translations/model/potmsgset.py'
--- lib/lp/translations/model/potmsgset.py 2011-02-04 17:14:20 +0000
+++ lib/lp/translations/model/potmsgset.py 2011-02-10 10:51:37 +0000
@@ -1028,6 +1028,14 @@
self, pofile.potemplate, pofile.language))
if other_incumbent is None:
traits.other_side_traits.setFlag(message, True)
+ elif incumbent_message is None:
+ # If this is the first translation, we
+ # override the existing translation for the
+ # other side.
+ if other_incumbent is not None:
+ traits.other_side_traits.setFlag(
+ other_incumbent, False)
+ traits.other_side_traits.setFlag(message, True)
elif character == '+':
if share_with_other_side:
traits.other_side_traits.setFlag(incumbent_message, False)
=== modified file 'lib/lp/translations/tests/test_setcurrenttranslation.py'
--- lib/lp/translations/tests/test_setcurrenttranslation.py 2010-11-18 04:08:16 +0000
+++ lib/lp/translations/tests/test_setcurrenttranslation.py 2011-02-10 10:51:37 +0000
@@ -175,10 +175,15 @@
new_translations, share_with_other_side=follows)
# We end up with a shared current translation.
- # Current for other context one stays the same.
+ # Current for other context one stays the same, if the
+ # other side does not follow this side.
self.assertTrue(tm is not None)
+ if follows:
+ expected_other = tm
+ else:
+ expected_other = tm_other
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
- tm, None, tm_other, [])
+ tm, None, expected_other, [])
def test_c_None__n_None__o_shared__follows(self):
# There is no current translation, though there is a shared one
@@ -318,14 +323,13 @@
new_translations, share_with_other_side=True)
# tm_suggestion becomes current.
- # Current for other context one stays the same.
+ # Current for other context is changed too.
self.assertTrue(tm is not None)
self.assertEquals(tm_suggestion, tm)
self.assert_Current_Diverged_Other_DivergencesElsewhere_are(
- tm, None, tm_other, [])
+ tm, None, tm, [])
- def test_c_None__n_shared__o_shared__identical(self,
- follows=False):
+ def test_c_None__n_shared__o_shared__identical(self, follows=False):
# Current translation is None, and we have found a
# shared existing TM matching new translations and it's
# also a current translation in "other" context.