Merge lp:~openerp-dev/openobject-addons/7.0-opw-590780-pna into lp:openobject-addons/7.0

Proposed by Pinakin Nayi (OpenERP) on 2013-04-09
Status: Merged
Approved by: Naresh(OpenERP) on 2013-04-11
Approved revision: no longer in the source branch.
Merged at revision: 9465
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-590780-pna
Merge into: lp:openobject-addons/7.0
Diff against target: 123 lines (+18/-17)
2 files modified
survey/report/survey_browse_response.py (+10/-9)
survey/wizard/survey_answer.py (+8/-8)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-590780-pna
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Approve on 2013-09-20
Naresh(OpenERP) (community) 2013-04-09 Approve on 2013-04-11
Review via email: mp+157795@code.launchpad.net

Description of the change

Hello Sir,

I improved missing translation in survey module.

Thanks,
pna

To post a comment you must log in.
review: Approve

LGTM, thanks for the patch

revno: 9465 [merge]
revision-id: <email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'survey/report/survey_browse_response.py'
2--- survey/report/survey_browse_response.py 2012-12-06 14:56:32 +0000
3+++ survey/report/survey_browse_response.py 2013-04-11 09:11:20 +0000
4@@ -26,6 +26,7 @@
5 from openerp.report import report_sxw
6 from openerp.report.interface import report_rml
7 from openerp.tools import to_xml
8+from openerp.tools.translate import _
9
10 class survey_browse_response(report_rml):
11 def create(self, cr, uid, ids, datas, context):
12@@ -66,7 +67,7 @@
13 rml +="""
14 <fill color="gray"/>
15 <setFont name="Helvetica" size="10"/>
16- <drawRightString x='"""+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+"""' y="0.6cm">Page : <pageNumber/> </drawRightString>"""
17+ <drawRightString x='"""+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+"""' y="0.6cm">"""+_('Page : ')+"""<pageNumber/> </drawRightString>"""
18 rml +="""</pageGraphics>
19 </pageTemplate>
20 </template>
21@@ -206,29 +207,29 @@
22 resp_create = tools.ustr(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S')))
23 rml += """<blockTable colWidths='""" + colwidth + """' style="Table_heading">
24 <tr>
25- <td><para style="terp_default_9_Bold">Print Date : </para></td>
26+ <td><para style="terp_default_9_Bold">""" + _('Print Date : ') + """</para></td>
27 <td><para style="terp_default_9">""" + to_xml(rml_obj.formatLang(time.strftime("%Y-%m-%d %H:%M:%S"),date_time=True)) + """</para></td>
28 <td><para style="terp_default_9"></para></td>
29- <td><para style="terp_default_9_Bold">Answered by : </para></td>
30+ <td><para style="terp_default_9_Bold">""" +_('Answered by : ') + """</para></td>
31 <td><para style="terp_default_9">""" + to_xml(response.user_id.login or '') + """</para></td>
32 </tr>
33 <tr>
34 <td><para style="terp_default_9"></para></td>
35 <td><para style="terp_default_9"></para></td>
36 <td><para style="terp_default_9"></para></td>
37- <td><para style="terp_default_9_Bold">Answer Date : </para></td>
38+ <td><para style="terp_default_9_Bold">""" +_('Answer Date : ') + """</para></td>
39 <td><para style="terp_default_9">""" + to_xml(resp_create) + """</para></td>
40 </tr>
41 </blockTable><para style="P2"></para>"""
42
43- status = "Not Finished"
44- if response.state == "done": status = "Finished"
45+ status = _("Not Finished")
46+ if response.state == "done": status = _("Finished")
47 colwidth = str(tbl_width - 7) + "cm,"
48 colwidth += "7cm"
49 rml += """<blockTable colWidths='""" + str(colwidth) + """' style="title_tbl">
50 <tr>
51 <td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td>
52- <td><para style="descriptive_text_heading">Status :- """ + to_xml(tools.ustr(status)) + """</para><para style="P2"><font></font></para></td>
53+ <td><para style="descriptive_text_heading">"""+_('Status :- ')+ to_xml(tools.ustr(status)) + """</para><para style="P2"><font></font></para></td>
54 </tr>
55 </blockTable>"""
56
57@@ -239,7 +240,7 @@
58
59 for page in survey.page_ids:
60 rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="page_tbl">
61- <tr><td><para style="page">Page :- """ + to_xml(tools.ustr(page.title or '')) + """</para></td></tr>
62+ <tr><td><para style="page">"""+_('Page :- ') + to_xml(tools.ustr(page.title or '')) + """</para></td></tr>
63 </blockTable>"""
64 if page.note:
65 rml += """<para style="P2"></para>
66@@ -299,7 +300,7 @@
67
68 else:
69 rml +="""<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
70- <tr><td> <para style="response">No Answer</para></td> </tr>
71+ <tr><td> <para style="response">"""+ _('No Answer') + """</para></td> </tr>
72 </blockTable>"""
73
74 elif que.type in ['multiple_choice_only_one_ans','multiple_choice_multiple_ans']:
75
76=== modified file 'survey/wizard/survey_answer.py'
77--- survey/wizard/survey_answer.py 2012-12-17 14:43:06 +0000
78+++ survey/wizard/survey_answer.py 2013-04-11 09:11:20 +0000
79@@ -171,8 +171,8 @@
80 # TODO: l10n, cleanup this code to make it readable. Or template?
81 xml_group = etree.SubElement(xml_form, 'group', {'col': '40', 'colspan': '4'})
82 record = sur_response_obj.browse(cr, uid, context['response_id'][context['response_no']])
83- etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr('Answer Of :- ' + record.user_id.name + ', Date :- ' + record.date_create.split('.')[0] )), 'align':"0.0"})
84- etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(" Answer :- " + str(context.get('response_no',0) + 1) +"/" + str(len(context.get('response_id',0))) )), 'align':"0.0"})
85+ etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(_('Answer Of :- ') + record.user_id.name + _(', Date :- ') + record.date_create.split('.')[0] )), 'align':"0.0"})
86+ etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(_(" Answer :- ") + str(context.get('response_no',0) + 1) +"/" + str(len(context.get('response_id',0))) )), 'align':"0.0"})
87 if context.get('response_no',0) > 0:
88 etree.SubElement(xml_group, 'button', {'colspan':"1",'icon':"gtk-go-back",'name':"action_forward_previous",'string': tools.ustr("Previous Answer"),'type':"object"})
89 if context.get('response_no',0) + 1 < len(context.get('response_id',0)):
90@@ -219,7 +219,7 @@
91 selection.append((tools.ustr(ans.id), ans.answer))
92 xml_group = etree.SubElement(xml_group, 'group', {'col': '2', 'colspan': '2'})
93 etree.SubElement(xml_group, 'field', {'readonly':str(readonly), 'name': tools.ustr(que.id) + "_selection"})
94- fields[tools.ustr(que.id) + "_selection"] = {'type':'selection', 'selection' :selection, 'string':"Answer"}
95+ fields[tools.ustr(que.id) + "_selection"] = {'type':'selection', 'selection' :selection, 'string':_('Answer')}
96
97 elif que_rec.type == 'multiple_choice_multiple_ans':
98 xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'})
99@@ -372,10 +372,10 @@
100
101 if pre_button:
102 etree.SubElement(xml_footer, 'label', {'string': ""})
103- etree.SubElement(xml_footer, 'button', {'name':"action_previous",'string':"Previous",'type':"object"})
104- but_string = "Next"
105+ etree.SubElement(xml_footer, 'button', {'name':"action_previous",'string':_('Previous'),'type':"object"})
106+ but_string = _('Next')
107 if int(page_number) + 1 == total_pages:
108- but_string = "Done"
109+ but_string = _('Done')
110 if context.has_key('active') and context.get('active',False) and int(page_number) + 1 == total_pages and context.has_key('response_id') and context.has_key('response_no') and context.get('response_no',0) + 1 == len(context.get('response_id',0)):
111 etree.SubElement(xml_footer, 'label', {'string': ""})
112 etree.SubElement(xml_footer, 'button', {'special' : 'cancel','string': tools.ustr("Done") ,'context' : tools.ustr(context), 'class':"oe_highlight"})
113@@ -388,8 +388,8 @@
114 else:
115 etree.SubElement(xml_footer, 'label', {'string': ""})
116 etree.SubElement(xml_footer, 'button', {'name':"action_next",'string': tools.ustr(but_string) ,'type':"object",'context' : tools.ustr(context), 'class':"oe_highlight"})
117- etree.SubElement(xml_footer, 'label', {'string': "or"})
118- etree.SubElement(xml_footer, 'button', {'special': "cancel",'string':"Exit",'class':"oe_link"})
119+ etree.SubElement(xml_footer, 'label', {'string': _('or')})
120+ etree.SubElement(xml_footer, 'button', {'special': "cancel",'string':_('Exit'),'class':"oe_link"})
121 etree.SubElement(xml_footer, 'label', {'string': tools.ustr(page_number+ 1) + "/" + tools.ustr(total_pages), 'class':"oe_survey_title_page oe_right"})
122
123 root = xml_form.getroottree()