[FIX] survey: add missing translations

bzr revid: mat@openerp.com-20130920123938-ioifrlv200rkalhe
This commit is contained in:
Martin Trigaux 2013-09-20 14:39:38 +02:00
commit 5397de6122
2 changed files with 18 additions and 17 deletions

View File

@ -26,6 +26,7 @@ from openerp import pooler, tools
from openerp.report import report_sxw
from openerp.report.interface import report_rml
from openerp.tools import to_xml
from openerp.tools.translate import _
class survey_browse_response(report_rml):
def create(self, cr, uid, ids, datas, context):
@ -66,7 +67,7 @@ class survey_browse_response(report_rml):
rml +="""
<fill color="gray"/>
<setFont name="Helvetica" size="10"/>
<drawRightString x='"""+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+"""' y="0.6cm">Page : <pageNumber/> </drawRightString>"""
<drawRightString x='"""+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+"""' y="0.6cm">"""+_('Page : ')+"""<pageNumber/> </drawRightString>"""
rml +="""</pageGraphics>
</pageTemplate>
</template>
@ -206,29 +207,29 @@ class survey_browse_response(report_rml):
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')))
rml += """<blockTable colWidths='""" + colwidth + """' style="Table_heading">
<tr>
<td><para style="terp_default_9_Bold">Print Date : </para></td>
<td><para style="terp_default_9_Bold">""" + _('Print Date : ') + """</para></td>
<td><para style="terp_default_9">""" + to_xml(rml_obj.formatLang(time.strftime("%Y-%m-%d %H:%M:%S"),date_time=True)) + """</para></td>
<td><para style="terp_default_9"></para></td>
<td><para style="terp_default_9_Bold">Answered by : </para></td>
<td><para style="terp_default_9_Bold">""" +_('Answered by : ') + """</para></td>
<td><para style="terp_default_9">""" + to_xml(response.user_id.login or '') + """</para></td>
</tr>
<tr>
<td><para style="terp_default_9"></para></td>
<td><para style="terp_default_9"></para></td>
<td><para style="terp_default_9"></para></td>
<td><para style="terp_default_9_Bold">Answer Date : </para></td>
<td><para style="terp_default_9_Bold">""" +_('Answer Date : ') + """</para></td>
<td><para style="terp_default_9">""" + to_xml(resp_create) + """</para></td>
</tr>
</blockTable><para style="P2"></para>"""
status = "Not Finished"
if response.state == "done": status = "Finished"
status = _("Not Finished")
if response.state == "done": status = _("Finished")
colwidth = str(tbl_width - 7) + "cm,"
colwidth += "7cm"
rml += """<blockTable colWidths='""" + str(colwidth) + """' style="title_tbl">
<tr>
<td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td>
<td><para style="descriptive_text_heading">Status :- """ + to_xml(tools.ustr(status)) + """</para><para style="P2"><font></font></para></td>
<td><para style="descriptive_text_heading">"""+_('Status :- ')+ to_xml(tools.ustr(status)) + """</para><para style="P2"><font></font></para></td>
</tr>
</blockTable>"""
@ -239,7 +240,7 @@ class survey_browse_response(report_rml):
for page in survey.page_ids:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="page_tbl">
<tr><td><para style="page">Page :- """ + to_xml(tools.ustr(page.title or '')) + """</para></td></tr>
<tr><td><para style="page">"""+_('Page :- ') + to_xml(tools.ustr(page.title or '')) + """</para></td></tr>
</blockTable>"""
if page.note:
rml += """<para style="P2"></para>
@ -299,7 +300,7 @@ class survey_browse_response(report_rml):
else:
rml +="""<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr><td> <para style="response">No Answer</para></td> </tr>
<tr><td> <para style="response">"""+ _('No Answer') + """</para></td> </tr>
</blockTable>"""
elif que.type in ['multiple_choice_only_one_ans','multiple_choice_multiple_ans']:

View File

@ -171,8 +171,8 @@ class survey_question_wiz(osv.osv_memory):
# TODO: l10n, cleanup this code to make it readable. Or template?
xml_group = etree.SubElement(xml_form, 'group', {'col': '40', 'colspan': '4'})
record = sur_response_obj.browse(cr, uid, context['response_id'][context['response_no']])
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"})
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"})
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"})
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"})
if context.get('response_no',0) > 0:
etree.SubElement(xml_group, 'button', {'colspan':"1",'icon':"gtk-go-back",'name':"action_forward_previous",'string': tools.ustr("Previous Answer"),'type':"object"})
if context.get('response_no',0) + 1 < len(context.get('response_id',0)):
@ -219,7 +219,7 @@ class survey_question_wiz(osv.osv_memory):
selection.append((tools.ustr(ans.id), ans.answer))
xml_group = etree.SubElement(xml_group, 'group', {'col': '2', 'colspan': '2'})
etree.SubElement(xml_group, 'field', {'readonly':str(readonly), 'name': tools.ustr(que.id) + "_selection"})
fields[tools.ustr(que.id) + "_selection"] = {'type':'selection', 'selection' :selection, 'string':"Answer"}
fields[tools.ustr(que.id) + "_selection"] = {'type':'selection', 'selection' :selection, 'string':_('Answer')}
elif que_rec.type == 'multiple_choice_multiple_ans':
xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'})
@ -372,10 +372,10 @@ class survey_question_wiz(osv.osv_memory):
if pre_button:
etree.SubElement(xml_footer, 'label', {'string': ""})
etree.SubElement(xml_footer, 'button', {'name':"action_previous",'string':"Previous",'type':"object"})
but_string = "Next"
etree.SubElement(xml_footer, 'button', {'name':"action_previous",'string':_('Previous'),'type':"object"})
but_string = _('Next')
if int(page_number) + 1 == total_pages:
but_string = "Done"
but_string = _('Done')
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)):
etree.SubElement(xml_footer, 'label', {'string': ""})
etree.SubElement(xml_footer, 'button', {'special' : 'cancel','string': tools.ustr("Done") ,'context' : tools.ustr(context), 'class':"oe_highlight"})
@ -388,8 +388,8 @@ class survey_question_wiz(osv.osv_memory):
else:
etree.SubElement(xml_footer, 'label', {'string': ""})
etree.SubElement(xml_footer, 'button', {'name':"action_next",'string': tools.ustr(but_string) ,'type':"object",'context' : tools.ustr(context), 'class':"oe_highlight"})
etree.SubElement(xml_footer, 'label', {'string': "or"})
etree.SubElement(xml_footer, 'button', {'special': "cancel",'string':"Exit",'class':"oe_link"})
etree.SubElement(xml_footer, 'label', {'string': _('or')})
etree.SubElement(xml_footer, 'button', {'special': "cancel",'string':_('Exit'),'class':"oe_link"})
etree.SubElement(xml_footer, 'label', {'string': tools.ustr(page_number+ 1) + "/" + tools.ustr(total_pages), 'class':"oe_survey_title_page oe_right"})
root = xml_form.getroottree()