Merge lp:~deryck/launchpad/upstream-empty-display-707825 into lp:launchpad

Proposed by Deryck Hodge
Status: Merged
Approved by: Deryck Hodge
Approved revision: no longer in the source branch.
Merged at revision: 12586
Proposed branch: lp:~deryck/launchpad/upstream-empty-display-707825
Merge into: lp:launchpad
Diff against target: 62 lines (+9/-8)
2 files modified
lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt (+2/-5)
lib/lp/translations/templates/translations-macros.pt (+7/-3)
To merge this branch: bzr merge lp:~deryck/launchpad/upstream-empty-display-707825
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+53050@code.launchpad.net

Commit message

[r=adeuring][bug=707825] When sharing translations between upstream and a package, display a "(not translated yet)" message if one side has set the translation to an empty string.

Description of the change

This is a fix for bug 707825, which outlines the situation
where a translation has been set to an empty string upstram,
causing the message to not appear as a suggestion for the
package side.

This fix ensure that a "(not translated yet)" message
appears if the suggested text is ''.

I discussed this a couple different times with Henning.

I fixed up the existing page test to display the text I
expected and then added a couple conditions in the template
to make this work out.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/translations/templates/translations-macros.pt
  lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt

./lib/lp/translations/templates/translations-macros.pt
     151: not well-formed (invalid token)
     150: Line has trailing whitespace.

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

nice branch! Just a minor remark:

@@ -65,7 +68,8 @@
     </tr>
     <tr
       tal:attributes="id string:${submission/origin_html_id};
- class string:discreet secondary ${dismissable}">
+ class string:discreet secondary ${dismissable}"
+ tal:condition="submission/suggestion_text">

I'd prefer to have "tal:condition" before "tal:attributes". While the ZPT machinery does not care about the order of tag attributes, I find it easier to read the tal: attributes in ZPT's execution order.

review: Approve (code)
Revision history for this message
Deryck Hodge (deryck) wrote :

Fixed up. Thanks for the suggestion! It's a good one.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt'
--- lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt 2011-01-26 15:01:36 +0000
+++ lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt 2011-03-11 18:57:22 +0000
@@ -580,13 +580,10 @@
580 ... '+source/evolution/+pots/evolution-2.2/es/5/+translate')580 ... '+source/evolution/+pots/evolution-2.2/es/5/+translate')
581 >>> packaged = find_tag_by_id(browser.contents, 'msgset_134_other')581 >>> packaged = find_tag_by_id(browser.contents, 'msgset_134_other')
582582
583XXX: 2011-01-25 henninge, bug=707825: This should either display nothing or583Also, the page now displays a "(not translated yet)" message.
584a string like "(no translation)". This documents the current behavior although
585it would be different if the translation had been properly reset. Also the
586wording here ("packaged") needs to be adapted.
587584
588 >>> print extract_text(packaged)585 >>> print extract_text(packaged)
589 In upstream:586 In upstream: (not translated yet)
590587
591588
592Shared and diverged translations589Shared and diverged translations
593590
=== modified file 'lib/lp/translations/templates/translations-macros.pt'
--- lib/lp/translations/templates/translations-macros.pt 2010-12-02 16:13:51 +0000
+++ lib/lp/translations/templates/translations-macros.pt 2011-03-11 18:57:22 +0000
@@ -41,8 +41,11 @@
41 </tal:form-writeable>41 </tal:form-writeable>
42 </td>42 </td>
43 <td>43 <td>
44 <div tal:condition="not:submission/suggestion_text">
45 (not translated yet)
46 </div>
44 <div47 <div
45 tal:condition="not:user_is_official_translator"48 tal:condition="python: not user_is_official_translator and submission.suggestion_text"
46 tal:attributes="49 tal:attributes="
47 lang submission/language/dashedcode;50 lang submission/language/dashedcode;
48 dir submission/language/abbreviated_text_dir;51 dir submission/language/abbreviated_text_dir;
@@ -52,7 +55,7 @@
52 </div>55 </div>
53 <label56 <label
54 style="white-space: normal"57 style="white-space: normal"
55 tal:condition="user_is_official_translator"58 tal:condition="python: user_is_official_translator and submission.suggestion_text"
56 tal:attributes="59 tal:attributes="
57 lang submission/language/dashedcode;60 lang submission/language/dashedcode;
58 dir submission/language/abbreviated_text_dir;61 dir submission/language/abbreviated_text_dir;
@@ -64,6 +67,7 @@
64 </td>67 </td>
65 </tr>68 </tr>
66 <tr69 <tr
70 tal:condition="submission/suggestion_text"
67 tal:attributes="id string:${submission/origin_html_id};71 tal:attributes="id string:${submission/origin_html_id};
68 class string:discreet secondary ${dismissable}">72 class string:discreet secondary ${dismissable}">
69 <td colspan="3"></td>73 <td colspan="3"></td>
@@ -144,7 +148,7 @@
144<metal:pofile-js-footer define-macro="pofile-js-footer">148<metal:pofile-js-footer define-macro="pofile-js-footer">
145 <script type="text/javascript"149 <script type="text/javascript"
146 tal:content="150 tal:content="
147 structure string:<!-- 151 structure string:<!--
148 var autofocus_field = '${view/autofocus_html_id}';152 var autofocus_field = '${view/autofocus_html_id}';
149 var translations_order = '${view/translations_order}';153 var translations_order = '${view/translations_order}';
150 var plural_forms = ${context/plural_forms};154 var plural_forms = ${context/plural_forms};