Ignore:
Timestamp:
5 Jul 2012, 15:28:28 (12 years ago)
Author:
Henrik Bettermann
Message:

Translate boolean values also in edit and manage pages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r8920 r8921  
    9191    return
    9292
     93def translated_values(view):
     94    lang = view.request.cookies.get('kofa.language')
     95    for value in view.context.values():
     96        value_dict = dict([i for i in value.__dict__.items()])
     97        value_dict['mandatory_bool'] = value.mandatory
     98        value_dict['mandatory'] = translate(str(value.mandatory), 'zope',
     99            target_language=lang)
     100        value_dict['carry_over'] = translate(str(value.carry_over), 'zope',
     101            target_language=lang)
     102        value_dict['automatic'] = translate(str(value.automatic), 'zope',
     103            target_language=lang)
     104        yield value_dict
     105
    93106class StudentsBreadcrumb(Breadcrumb):
    94107    """A breadcrumb for the students container.
     
    710723    @property
    711724    def translated_values(self):
    712         lang = self.request.cookies.get('kofa.language')
    713         for value in self.context.values():
    714             value_dict = dict([i for i in value.__dict__.items()])
    715             value_dict['mandatory'] = translate(str(value.mandatory), 'zope',
    716                 target_language=lang)
    717             value_dict['carry_over'] = translate(str(value.carry_over), 'zope',
    718                 target_language=lang)
    719             value_dict['automatic'] = translate(str(value.automatic), 'zope',
    720                 target_language=lang)
    721             yield value_dict
     725        return translated_values(self)
    722726
    723727    @property
     
    821825        datatable.need()
    822826        return
     827
     828    @property
     829    def translated_values(self):
     830        return translated_values(self)
    823831
    824832    @property
     
    17871795        return total_credits
    17881796
     1797    @property
     1798    def translated_values(self):
     1799        return translated_values(self)
     1800
    17891801    @action(_('Add course ticket'))
    17901802    def addCourseTicket(self, **data):
Note: See TracChangeset for help on using the changeset viewer.