Changeset 8141


Ignore:
Timestamp:
13 Apr 2012, 10:00:27 (13 years ago)
Author:
Henrik Bettermann
Message:

Translate boolean values in tables and slips.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/locales/de/LC_MESSAGES/zope.po

    r8024 r8141  
    22msgstr ""
    33"Project-Id-Version: WAeUP.KOFA\n"
    4 "PO-Revision-Date: 2012-04-03 09:28+0100\n"
     4"PO-Revision-Date: 2012-04-13 10:21+0100\n"
    55"Last-Translator: Henrik Bettermann <henrik@waeup.org>\n"
    66"Language-Team: WAeUP Germany <henrik@waeup.org>\n"
     
    4949msgstr "--"
    5050
     51#: src/zope/app/form/browser/boolwidgets.py:121
     52msgid "True"
     53msgstr "ja"
     54
     55#: src/zope/app/form/browser/boolwidgets.py:122
     56msgid "False"
     57msgstr "nein"
     58
  • main/waeup.kofa/trunk/src/waeup/kofa/locales/en/LC_MESSAGES/zope.po

    r8024 r8141  
    22msgstr ""
    33"Project-Id-Version: WAeUP.KOFA\n"
    4 "PO-Revision-Date: 2012-04-03 08:19+0100\n"
     4"PO-Revision-Date: 2012-04-13 10:18+0100\n"
    55"Last-Translator: Henrik Bettermann <henrik@waeup.org>\n"
    66"Language-Team: WAeUP Germany <henrik@waeup.org>\n"
     
    4949msgstr "--"
    5050
     51#: src/zope/app/form/browser/boolwidgets.py:121
     52msgid "True"
     53msgstr "yes"
     54
     55#: src/zope/app/form/browser/boolwidgets.py:122
     56msgid "False"
     57msgstr "no"
     58
  • main/waeup.kofa/trunk/src/waeup/kofa/locales/zope.pot

    r8024 r8141  
    4747msgid "sequence-value-is-empty"
    4848msgstr ""
     49
     50#: src/zope/app/form/browser/boolwidgets.py:121
     51msgid "True"
     52msgstr ""
     53
     54#: src/zope/app/form/browser/boolwidgets.py:122
     55msgid "False"
     56msgstr ""
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r8120 r8141  
    710710
    711711    @property
     712    def translated_values(self):
     713        lang = self.request.cookies.get('kofa.language')
     714        for value in self.context.values():
     715            import pdb; pdb.set_trace()
     716            value_dict = value.__dict__
     717            value_dict['mandatory'] = translate(str(value.mandatory), 'zope',
     718                target_language=lang)
     719            value_dict['carry_over'] = translate(str(value.carry_over), 'zope',
     720                target_language=lang)
     721            value_dict['automatic'] = translate(str(value.automatic), 'zope',
     722                target_language=lang)
     723            yield value_dict
     724
     725    @property
    712726    def label(self):
    713727        # Here we know that the cookie has been set
     
    753767        level_title = translate(self.context.level_title, 'waeup.kofa',
    754768            target_language=lang)
    755         return translate(_('Course Registration Slip  '),
     769        return translate(_('Course Registration Slip'),
    756770            'waeup.kofa', target_language=portal_language) \
    757771            + ' %s' % level_title
     
    780794                         (Cred, 'credits', 1.5),
    781795                         (Mand, 'mandatory', 1.5),
    782                          (Score, 'score', 1.5),('Auto', 'automatic', 1.5)
     796                         (Score, 'score', 1.5),
     797                         #('Auto', 'automatic', 1.5)
    783798                         ],
    784799            tabledata=tabledata)
     
    910925    label = _('Add course ticket')
    911926    form_fields = grok.AutoFields(ICourseTicketAdd).omit(
    912         'grade', 'score', 'automatic', 'carry_over')
     927        'score', 'automatic', 'carry_over')
    913928    pnav = 4
    914929
     
    918933        course = data['course']
    919934        ticket.automatic = False
     935        ticket.carry_over = False
    920936        ticket.code = course.code
    921937        ticket.title = course.title
     
    18491865    grok.require('waeup.handleStudent')
    18501866    form_fields = grok.AutoFields(ICourseTicketAdd).omit(
    1851         'grade', 'score', 'mandatory', 'automatic', 'carry_over')
     1867        'score', 'mandatory', 'automatic', 'carry_over')
    18521868
    18531869    def update(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studylevelpage.pt

    r7876 r8141  
    4444  </thead>
    4545  <tbody>
    46     <tr tal:repeat="value context/values" class="gradeC">
     46    <tr tal:repeat="value view/translated_values" class="gradeC">
    4747      <td tal:content="value/semester">SEMESTER</td>
    4848      <td> <a tal:attributes="href value/__name__">
     
    5454      <td tal:content="value/credits">CREDITS</td>
    5555      <td tal:content="value/mandatory">MANDATORY</td>
    56       <td tal:content="value/score">SCORE</td>
     56      <td tal:content="value/score|nothing">SCORE</td>
    5757      <td tal:content="value/carry_over">CO</td>
    5858      <td tal:content="value/automatic">AUTO</td>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studycourse.py

    r7811 r8141  
    6464                ticket.passmark = val.course.passmark
    6565                ticket.semester = val.course.semester
     66                ticket.carry_over = False
    6667                self[str(studylevel.level)][ticket.code] = ticket
    6768        # Collect carry-over courses in base levels (not in repeating levels)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r8120 r8141  
    7777    The returned snippet is unicode type.
    7878    """
     79    portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    7980    if not isinstance(text, unicode):
    8081        if isinstance(text, basestring):
     
    8283        else:
    8384            text = unicode(text)
     85    # Mainly for boolean values we need our customized
     86    # localisation of the zope domain
     87    text = translate(text, 'zope', target_language=portal_language)
    8488    text = text.replace('</div>', '<br /></div>')
    8589    tag1 = u'<font color="%s" size="%d">' % (color, size)
     
    335339        data.extend(docs_as_flowables(view, portal_language))
    336340
    337         # Insert content table on second page
     341        # Insert content table (optionally on second page)
    338342        if tabledata and tableheader:
    339             data.append(PageBreak())
     343            #data.append(PageBreak())
     344            data.append(Spacer(1, 20))
    340345            data.append(Paragraph(view.content_title, style["Heading3"]))
    341346            contenttable = render_table_data(tableheader,tabledata)
Note: See TracChangeset for help on using the changeset viewer.