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
1=== modified file 'lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt'
2--- lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt 2011-01-26 15:01:36 +0000
3+++ lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt 2011-03-11 18:57:22 +0000
4@@ -580,13 +580,10 @@
5 ... '+source/evolution/+pots/evolution-2.2/es/5/+translate')
6 >>> packaged = find_tag_by_id(browser.contents, 'msgset_134_other')
7
8-XXX: 2011-01-25 henninge, bug=707825: This should either display nothing or
9-a string like "(no translation)". This documents the current behavior although
10-it would be different if the translation had been properly reset. Also the
11-wording here ("packaged") needs to be adapted.
12+Also, the page now displays a "(not translated yet)" message.
13
14 >>> print extract_text(packaged)
15- In upstream:
16+ In upstream: (not translated yet)
17
18
19 Shared and diverged translations
20
21=== modified file 'lib/lp/translations/templates/translations-macros.pt'
22--- lib/lp/translations/templates/translations-macros.pt 2010-12-02 16:13:51 +0000
23+++ lib/lp/translations/templates/translations-macros.pt 2011-03-11 18:57:22 +0000
24@@ -41,8 +41,11 @@
25 </tal:form-writeable>
26 </td>
27 <td>
28+ <div tal:condition="not:submission/suggestion_text">
29+ (not translated yet)
30+ </div>
31 <div
32- tal:condition="not:user_is_official_translator"
33+ tal:condition="python: not user_is_official_translator and submission.suggestion_text"
34 tal:attributes="
35 lang submission/language/dashedcode;
36 dir submission/language/abbreviated_text_dir;
37@@ -52,7 +55,7 @@
38 </div>
39 <label
40 style="white-space: normal"
41- tal:condition="user_is_official_translator"
42+ tal:condition="python: user_is_official_translator and submission.suggestion_text"
43 tal:attributes="
44 lang submission/language/dashedcode;
45 dir submission/language/abbreviated_text_dir;
46@@ -64,6 +67,7 @@
47 </td>
48 </tr>
49 <tr
50+ tal:condition="submission/suggestion_text"
51 tal:attributes="id string:${submission/origin_html_id};
52 class string:discreet secondary ${dismissable}">
53 <td colspan="3"></td>
54@@ -144,7 +148,7 @@
55 <metal:pofile-js-footer define-macro="pofile-js-footer">
56 <script type="text/javascript"
57 tal:content="
58- structure string:<!--
59+ structure string:<!--
60 var autofocus_field = '${view/autofocus_html_id}';
61 var translations_order = '${view/translations_order}';
62 var plural_forms = ${context/plural_forms};