Changeset 7723


Ignore:
Timestamp:
29 Feb 2012, 13:29:35 (13 years ago)
Author:
Henrik Bettermann
Message:

Start internationalization of students package (work in progress).

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/workflow.py

    r7719 r7723  
    2626from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent
    2727from waeup.sirp.accesscodes.interfaces import IAccessCode
    28 from waeup.sirp.interfaces import IObjectHistory, ISIRPWorkflowInfo, ISIRPUtils
     28from waeup.sirp.interfaces import IObjectHistory, ISIRPWorkflowInfo
    2929from waeup.sirp.interfaces import MessageFactory as _
    3030from waeup.sirp.workflow import SIRPWorkflow, SIRPWorkflowInfo
     
    133133def handle_accesscode_transition_event(obj, event):
    134134    # append message to history
    135     portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    136135    if event.comment is not None:
    137136        msg = event.comment
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7687 r7723  
    2424from datetime import datetime
    2525from zope.event import notify
     26from zope.i18n import translate
    2627from zope.catalog.interfaces import ICatalog
    2728from zope.component import queryUtility, getUtility, createObject
     
    7778        notify(grok.ObjectModifiedEvent(view.context.getStudent()))
    7879    fields_string = ' + '.join(changed_fields)
    79     view.flash('Form has been saved.')
     80    view.flash(_('Form has been saved.'))
    8081    if fields_string:
    8182        write_log_message(view, 'saved: %s' % fields_string)
     
    8586    """Flash a lock message.
    8687    """
    87     view.flash('The requested form is locked (read-only).')
     88    view.flash(_('The requested form is locked (read-only).'))
    8889    view.redirect(view.url(view.context))
    8990    return
     
    9394    """
    9495    grok.context(IStudentsContainer)
    95     title = 'Students'
     96    title = _('Students')
    9697
    9798    @property
     
    114115    """
    115116    grok.context(IStudentStudyCourse)
    116     title = 'Study Course'
     117    title = _('Study Course')
    117118
    118119class PaymentsBreadcrumb(Breadcrumb):
     
    120121    """
    121122    grok.context(IStudentPaymentsContainer)
    122     title = 'Payments'
     123    title = _('Payments')
    123124
    124125class OnlinePaymentBreadcrumb(Breadcrumb):
     
    135136    """
    136137    grok.context(IStudentAccommodation)
    137     title = 'Accommodation'
     138    title = _('Accommodation')
    138139
    139140class BedTicketBreadcrumb(Breadcrumb):
     
    144145    @property
    145146    def title(self):
    146         return 'Bed Ticket %s' % self.context.getSessionString()
     147        return _('Bed Ticket ${a}',
     148            mapping = {'a':self.context.getSessionString()})
    147149
    148150class StudyLevelBreadcrumb(Breadcrumb):
     
    153155    @property
    154156    def title(self):
    155         return self.context.level_title
     157        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     158        # There is no request attribute, thus we can only translate
     159        # to the default (portal) language
     160        return translate(self.context.level_title, 'waeup.sirp',
     161            target_language=portal_language)
    156162
    157163class StudentsContainerPage(SIRPPage):
     
    162168    grok.require('waeup.viewStudentsContainer')
    163169    grok.template('containerpage')
    164     label = 'Student Section'
     170    label = _('Student Section')
    165171    pnav = 4
    166172
     
    177183        else:
    178184            if 'search' in form:
    179                 self.flash('Empty search string.')
     185                self.flash(_('Empty search string.'))
    180186            return
    181187        if self.searchtype == 'current_session':
     
    195201    grok.template('containermanagepage')
    196202    pnav = 4
    197     label = 'Manage student section'
     203    label = _('Manage student section')
    198204
    199205    def update(self, *args, **kw):
     
    211217        else:
    212218            if 'search' in form:
    213                 self.flash('Empty search string.')
     219                self.flash(_('Empty search string.'))
    214220            return
    215221        if not 'entries' in form:
     
    217223                searchtype=self.searchtype, view=self)
    218224            if not self.hitlist:
    219                 self.flash('No student found.')
     225                self.flash(_('No student found.'))
    220226            if 'remove' in form:
    221                 self.flash('No item selected.')
     227                self.flash(_('No item selected.'))
    222228            return
    223229        entries = form['entries']
     
    232238            searchtype=self.searchtype, view=self)
    233239        if len(deleted):
    234             self.flash('Successfully removed: %s' % ', '.join(deleted))
     240            self.flash(_('Successfully removed: ${a}',
     241                mapping = {'a':', '.join(deleted)}))
    235242        return
    236243
     
    243250    form_fields = grok.AutoFields(IStudent).select(
    244251        'firstname', 'middlename', 'lastname', 'reg_number')
    245     label = 'Add student'
    246     pnav = 4
    247 
    248     @action('Create student record', style='primary')
     252    label = _('Add student')
     253    pnav = 4
     254
     255    @action(_('Create student record'), style='primary')
    249256    def addStudent(self, **data):
    250257        student = createObject(u'waeup.Student')
    251258        self.applyData(student, **data)
    252259        self.context.addStudent(student)
    253         self.flash('Student record created.')
     260        self.flash(_('Student record created.'))
    254261        self.redirect(self.url(self.context[student.student_id], 'index'))
    255262        return
     
    267274    @property
    268275    def label(self):
    269         return '%s: Base Data' % self.context.display_fullname
     276        return _('${a}: Base Data',
     277            mapping = {'a':self.context.display_fullname})
    270278
    271279    @property
    272280    def hasPassword(self):
    273281        if self.context.password:
    274             return 'set'
    275         return 'unset'
     282            return _('set')
     283        return _('unset')
    276284
    277285class ContactStudentForm(ContactAdminForm):
     
    288296
    289297    def label(self):
    290         return u'Send message to %s' % self.context.display_fullname
     298        return _(u'Send message to ${a}',
     299            mapping = {'a':self.context.display_fullname})
    291300
    292301    @action('Send message now', style='primary')
     
    306315                data['body'],data['subject'])
    307316        if success:
    308             self.flash('Your message has been sent.')
     317            self.flash(_('Your message has been sent.'))
    309318        else:
    310             self.flash('An smtp server error occurred.')
     319            self.flash(_('An smtp server error occurred.'))
    311320        return
    312321
     
    319328    form_fields = grok.AutoFields(IStudentBase).omit('student_id')
    320329    grok.template('basemanagepage')
    321     label = 'Manage base data'
     330    label = _('Manage base data')
    322331    pnav = 4
    323332
     
    345354            dict(name=x, title=y) for x, y in allowed_transitions]
    346355
    347     @action('Save', style='primary')
     356    @action(_('Save'), style='primary')
    348357    def save(self, **data):
    349358        form = self.request.form
     
    371380            self.wf_info.fireTransition(transition_id)
    372381        fields_string = ' + '.join(changed_fields)
    373         self.flash('Form has been saved.')
     382        self.flash(_('Form has been saved.'))
    374383        if fields_string:
    375384            write_log_message(self, 'saved: % s' % fields_string)
     
    388397    @property
    389398    def label(self):
    390         return '%s: Clearance Data' % self.context.display_fullname
     399        return _('${a}: Clearance Data',
     400            mapping = {'a':self.context.display_fullname})
    391401
    392402class ExportPDFClearanceSlipPage(grok.View):
     
    399409    form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
    400410    prefix = 'form'
    401     title = 'Clearance Data'
     411
     412    @property
     413    def title(self):
     414        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     415        return translate(_('Clearance Data'), 'waeup.sirp',
     416            target_language=portal_language)
    402417
    403418    @property
    404419    def label(self):
    405         return 'Clearance Slip of %s' % self.context.display_fullname
     420        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     421        return translate(_('Clearance Slip of '),
     422            'waeup.sirp', target_language=portal_language) \
     423            + ' %s' % self.context.display_fullname
    406424
    407425    def render(self):
     
    421439    grok.template('clearanceeditpage')
    422440    form_fields = grok.AutoFields(IStudentClearance)
    423     label = 'Manage clearance data'
     441    label = _('Manage clearance data')
    424442    pnav = 4
    425443    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
     
    435453        return super(StudentClearanceManageFormPage, self).update()
    436454
    437     @action('Save', style='primary')
     455    @action(_('Save'), style='primary')
    438456    def save(self, **data):
    439457        msave(self, **data)
     
    450468        if self.context.state == REQUESTED:
    451469            IWorkflowInfo(self.context).fireTransition('clear')
    452             self.flash('Student has been cleared.')
     470            self.flash(_('Student has been cleared.'))
    453471        else:
    454             self.flash('Student is in the wrong state.')
     472            self.flash(_('Student is in wrong state.'))
    455473        self.redirect(self.url(self.context,'view_clearance'))
    456474        return
     
    469487        if self.context.state == CLEARED:
    470488            IWorkflowInfo(self.context).fireTransition('reset4')
    471             message = 'Clearance has been annulled'
     489            message = _('Clearance has been annulled.')
    472490            self.flash(message)
    473491        elif self.context.state == REQUESTED:
    474492            IWorkflowInfo(self.context).fireTransition('reset3')
    475             message = 'Clearance request has been rejected'
     493            message = _('Clearance request has been rejected.')
    476494            self.flash(message)
    477495        else:
    478             self.flash('Student is in the wrong state.')
     496            self.flash(_('Student is in wrong state.'))
    479497            self.redirect(self.url(self.context,'view_clearance'))
    480498            return
     
    499517    @property
    500518    def label(self):
    501         return '%s: Personal Data' % self.context.display_fullname
     519        return _('${a}: Personal Data',
     520            mapping = {'a':self.context.display_fullname})
    502521
    503522class StudentPersonalManageFormPage(SIRPEditFormPage):
     
    508527    grok.require('waeup.viewStudent')
    509528    form_fields = grok.AutoFields(IStudentPersonal)
    510     label = 'Manage personal data'
    511     pnav = 4
    512 
    513     @action('Save', style='primary')
     529    label = _('Manage personal data')
     530    pnav = 4
     531
     532    @action(_('Save'), style='primary')
    514533    def save(self, **data):
    515534        msave(self, **data)
     
    528547    @property
    529548    def label(self):
    530         return '%s: Study Course' % self.context.__parent__.display_fullname
     549        return _('${a}: Study Course',
     550            mapping = {'a':self.context.__parent__.display_fullname})
    531551
    532552    @property
     
    557577    grok.template('studycoursemanagepage')
    558578    form_fields = grok.AutoFields(IStudentStudyCourse)
    559     label = 'Manage study course'
    560     pnav = 4
    561     taboneactions = ['Save','Cancel']
    562     tabtwoactions = ['Remove selected levels','Cancel']
    563     tabthreeactions = ['Add study level']
     579    label = _('Manage study course')
     580    pnav = 4
     581    taboneactions = [_('Save'),_('Cancel')]
     582    tabtwoactions = [_('Remove selected levels'),_('Cancel')]
     583    tabthreeactions = [_('Add study level')]
    564584
    565585    def update(self):
     
    575595        return
    576596
    577     @action('Save', style='primary')
     597    @action(_('Save'), style='primary')
    578598    def save(self, **data):
    579599        msave(self, **data)
     
    587607            yield(dict(code=code, title=title))
    588608
    589     @action('Add study level')
     609    @action(_('Add study level'))
    590610    def addStudyLevel(self, **data):
    591611        level_code = self.request.form.get('addlevel', None)
     
    595615            self.context.addStudentStudyLevel(
    596616                self.context.certificate,studylevel)
    597             self.flash('Study level has been added.')
     617            self.flash(_('Study level has been added.'))
    598618        except KeyError:
    599             self.flash('This level exists.')
     619            self.flash(_('This level exists.'))
    600620        self.redirect(self.url(self.context, u'@@manage')+'?tab2')
    601621        return
    602622
    603     @jsaction('Remove selected levels')
     623    @jsaction(_('Remove selected levels'))
    604624    def delStudyLevels(self, **data):
    605625        form = self.request.form
     
    607627            child_id = form['val_id']
    608628        else:
    609             self.flash('No study level selected.')
     629            self.flash(_('No study level selected.'))
    610630            self.redirect(self.url(self.context, '@@manage')+'?tab2')
    611631            return
     
    614634        deleted = []
    615635        for id in child_id:
    616             try:
    617                 del self.context[id]
    618                 deleted.append(id)
    619             except:
    620                 self.flash('Could not delete %s: %s: %s' % (
    621                         id, sys.exc_info()[0], sys.exc_info()[1]))
     636            del self.context[id]
     637            deleted.append(id)
    622638        if len(deleted):
    623             self.flash('Successfully removed: %s' % ', '.join(deleted))
     639            self.flash(_('Successfully removed: ${a}',
     640                mapping = {'a':', '.join(deleted)}))
    624641        self.redirect(self.url(self.context, u'@@manage')+'?tab2')
    625642        return
     
    642659    @property
    643660    def label(self):
    644         return '%s: Study Level %s' % (
    645             self.context.getStudent().display_fullname,self.context.level_title)
     661        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     662        lang = self.request.cookies.get('sirp.language', portal_language)
     663        level_title = translate(self.context.level_title, 'waeup.sirp',
     664            target_language=lang)
     665        return _('${a}: Study Level ${b}', mapping = {
     666            'a':self.context.getStudent().display_fullname,
     667            'b':level_title})
    646668
    647669    @property
     
    660682    form_fields = grok.AutoFields(IStudentStudyLevel)
    661683    prefix = 'form'
    662     title = 'Level Data'
    663     content_title = 'Course List'
     684
     685    @property
     686    def title(self):
     687        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     688        return translate(_('Level Data'), 'waeup.sirp',
     689            target_language=portal_language)
     690
     691    @property
     692    def content_title(self):
     693        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     694        return translate(_('Course List'), 'waeup.sirp',
     695            target_language=portal_language)
    664696
    665697    @property
    666698    def label(self):
    667         return 'Course Registration Slip %s' % self.context.level_title
     699        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     700        lang = self.request.cookies.get('sirp.language', portal_language)
     701        level_title = translate(self.context.level_title, 'waeup.sirp',
     702            target_language=lang)
     703        return translate(_('Course Registration Slip  '),
     704            'waeup.sirp', target_language=portal_language) \
     705            + ' %s' % level_title
    668706
    669707    def render(self):
     708        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     709        Sem = translate(_('Sem.'), 'waeup.sirp', target_language=portal_language)
     710        Code = translate(_('Code'), 'waeup.sirp', target_language=portal_language)
     711        Title = translate(_('Title'), 'waeup.sirp', target_language=portal_language)
     712        Dept = translate(_('Dept.'), 'waeup.sirp', target_language=portal_language)
     713        Faculty = translate(_('Faculty'), 'waeup.sirp', target_language=portal_language)
     714        Cred = translate(_('Cred.'), 'waeup.sirp', target_language=portal_language)
     715        Mand = translate(_('Mand.'), 'waeup.sirp', target_language=portal_language)
     716        Score = translate(_('Score'), 'waeup.sirp', target_language=portal_language)
    670717        studentview = StudentBaseDisplayFormPage(self.context.getStudent(),
    671718            self.request)
     
    676723            self, 'course_registration.pdf',
    677724            self.context.getStudent(), studentview,
    678             tableheader=[('Sem.','semester', 1.5),('Code','code', 2.5),
    679                          ('Title','title', 5),
    680                          ('Dept.','dcode', 1.5), ('Faculty','fcode', 1.5),
    681                          ('Cred.', 'credits', 1.5),
    682                          ('Mand.', 'mandatory', 1.5),
    683                          ('Score', 'score', 1.5),('Auto', 'automatic', 1.5)
     725            tableheader=[(Sem,'semester', 1.5),(Code,'code', 2.5),
     726                         (Title,'title', 5),
     727                         (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5),
     728                         (Cred, 'credits', 1.5),
     729                         (Mand, 'mandatory', 1.5),
     730                         (Score, 'score', 1.5),('Auto', 'automatic', 1.5)
    684731                         ],
    685732            tabledata=tabledata)
     
    694741    form_fields = grok.AutoFields(IStudentStudyLevel)
    695742    pnav = 4
    696     taboneactions = ['Save','Cancel']
    697     tabtwoactions = ['Add course ticket','Remove selected tickets','Cancel']
     743    taboneactions = [_('Save'),_('Cancel')]
     744    tabtwoactions = [_('Add course ticket'),
     745        _('Remove selected tickets'),_('Cancel')]
    698746
    699747    def update(self):
     
    711759    @property
    712760    def label(self):
    713         return 'Manage study level %s' % self.context.level_title
    714 
    715     @action('Save', style='primary')
     761        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     762        lang = self.request.cookies.get('sirp.language', portal_language)
     763        level_title = translate(self.context.level_title, 'waeup.sirp',
     764            target_language=lang)
     765        return _('Manage study level ${a}',
     766            mapping = {'a':level_title})
     767
     768    @action(_('Save'), style='primary')
    716769    def save(self, **data):
    717770        msave(self, **data)
    718771        return
    719772
    720     @action('Add course ticket')
     773    @action(_('Add course ticket'))
    721774    def addCourseTicket(self, **data):
    722775        self.redirect(self.url(self.context, '@@add'))
    723776
    724     @jsaction('Remove selected tickets')
     777    @jsaction(_('Remove selected tickets'))
    725778    def delCourseTicket(self, **data):
    726779        form = self.request.form
     
    728781            child_id = form['val_id']
    729782        else:
    730             self.flash('No ticket selected.')
     783            self.flash(_('No ticket selected.'))
    731784            self.redirect(self.url(self.context, '@@manage')+'?tab2')
    732785            return
     
    735788        deleted = []
    736789        for id in child_id:
    737             try:
    738                 del self.context[id]
    739                 deleted.append(id)
    740             except:
    741                 self.flash('Could not delete %s: %s: %s' % (
    742                         id, sys.exc_info()[0], sys.exc_info()[1]))
     790            del self.context[id]
     791            deleted.append(id)
    743792        if len(deleted):
    744             self.flash('Successfully removed: %s' % ', '.join(deleted))
     793            self.flash(_('Successfully removed: ${a}',
     794                mapping = {'a':', '.join(deleted)}))
    745795        self.redirect(self.url(self.context, u'@@manage')+'?tab2')
    746796        return
     
    755805    def update(self):
    756806        if str(self.context.__parent__.current_level) != self.context.__name__:
    757             self.flash('This level does not correspond current level.')
     807            self.flash(_('This level does not correspond current level.'))
    758808        elif self.context.getStudent().state == REGISTERED:
    759809            IWorkflowInfo(self.context.getStudent()).fireTransition(
    760810                'validate_courses')
    761             self.flash('Course list has been validated.')
     811            self.flash(_('Course list has been validated.'))
    762812        else:
    763             self.flash('Student is in the wrong state.')
     813            self.flash(_('Student is in the wrong state.'))
    764814        self.redirect(self.url(self.context))
    765815        return
     
    777827    def update(self):
    778828        if str(self.context.__parent__.current_level) != self.context.__name__:
    779             self.flash('This level does not correspond current level.')
     829            self.flash(_('This level does not correspond current level.'))
    780830            self.redirect(self.url(self.context))
    781831            return
    782832        elif self.context.getStudent().state == VALIDATED:
    783833            IWorkflowInfo(self.context.getStudent()).fireTransition('reset8')
    784             message = 'Course list request has been annulled'
     834            message = _('Course list request has been annulled.')
    785835            self.flash(message)
    786836        elif self.context.getStudent().state == REGISTERED:
    787837            IWorkflowInfo(self.context.getStudent()).fireTransition('reset7')
    788             message = 'Course list request has been rejected'
     838            message = _('Course list request has been rejected:')
    789839            self.flash(message)
    790840        else:
    791             self.flash('Student is in the wrong state.')
     841            self.flash(_('Student is in the wrong state.'))
    792842            self.redirect(self.url(self.context))
    793843            return
     
    806856    grok.name('add')
    807857    grok.require('waeup.manageStudent')
    808     label = 'Add course ticket'
     858    label = _('Add course ticket')
    809859    form_fields = grok.AutoFields(ICourseTicketAdd).omit(
    810860        'grade', 'score', 'automatic', 'carry_over')
    811861    pnav = 4
    812862
    813     @action('Add course ticket')
     863    @action(_('Add course ticket'))
    814864    def addCourseTicket(self, **data):
    815865        ticket = CourseTicket()
     
    826876            self.context.addCourseTicket(ticket)
    827877        except KeyError:
    828             self.flash('The ticket exists.')
    829             return
    830         self.flash('Successfully added %s.' % ticket.code)
     878            self.flash(_('The ticket exists.'))
     879            return
     880        self.flash(_('Successfully added ${a}.',
     881            mapping = {'a':ticket.code}))
    831882        self.redirect(self.url(self.context, u'@@manage')+'?tab2')
    832883        return
    833884
    834     @action('Cancel')
     885    @action(_('Cancel'))
    835886    def cancel(self, **data):
    836887        self.redirect(self.url(self.context))
     
    848899    @property
    849900    def label(self):
    850         return '%s: Course Ticket %s' % (
    851             self.context.getStudent().display_fullname,self.context.code)
     901        return _('${a}: Course Ticket ${b}', mapping = {
     902            'a':self.context.getStudent().display_fullname,
     903            'b':self.context.code})
    852904
    853905class CourseTicketManageFormPage(SIRPEditFormPage):
     
    863915    @property
    864916    def label(self):
    865         return 'Manage course ticket %s' % self.context.code
     917        return _('Manage course ticket ${a}', mapping = {'a':self.context.code})
    866918
    867919    @action('Save', style='primary')
     
    890942    @property
    891943    def label(self):
    892         return '%s: Payments' % self.context.__parent__.display_fullname
     944        return _('${a}: Payments',
     945            mapping = {'a':self.context.__parent__.display_fullname})
    893946
    894947    def update(self):
     
    898951        return
    899952
    900     @jsaction('Remove selected tickets')
     953    @jsaction(_('Remove selected tickets'))
    901954    def delPaymentTicket(self, **data):
    902955        form = self.request.form
     
    904957            child_id = form['val_id']
    905958        else:
    906             self.flash('No payment selected.')
     959            self.flash(_('No payment selected.'))
    907960            self.redirect(self.url(self.context))
    908961            return
     
    913966            # Students are not allowed to remove used payment tickets
    914967            if not self.unremovable(self.context[id]):
    915                 try:
    916                     del self.context[id]
    917                     deleted.append(id)
    918                 except:
    919                     self.flash('Could not delete %s: %s: %s' % (
    920                             id, sys.exc_info()[0], sys.exc_info()[1]))
     968                del self.context[id]
     969                deleted.append(id)
    921970        if len(deleted):
    922             self.flash('Successfully removed: %s' % ', '.join(deleted))
     971            self.flash(_('Successfully removed: ${a}',
     972                mapping = {'a': ', '.join(deleted)}))
    923973            write_log_message(self,'removed: % s' % ', '.join(deleted))
    924974        self.redirect(self.url(self.context))
    925975        return
    926976
    927     @action('Add online payment ticket')
     977    @action(_('Add online payment ticket'))
    928978    def addPaymentTicket(self, **data):
    929979        self.redirect(self.url(self.context, '@@addop'))
     
    937987    form_fields = grok.AutoFields(IStudentOnlinePayment).select(
    938988        'p_category')
    939     label = 'Add online payment'
    940     pnav = 4
    941 
    942     @action('Create ticket', style='primary')
     989    label = _('Add online payment')
     990    pnav = 4
     991
     992    @action(_('Create ticket'), style='primary')
    943993    def createTicket(self, **data):
    944994        p_category = data['p_category']
     
    948998            'configuration'].accommodation_session:
    949999                self.flash(
    950                     'Your current session does not match '
    951                     'accommodation session.')
     1000                    _('Your current session does not match ' + \
     1001                    'accommodation session.'))
    9521002                self.redirect(self.url(self.context))
    9531003                return
     
    9681018               ticket.p_session == p_session:
    9691019                  self.flash(
    970                       'This type of payment has already been made.')
     1020                      _('This type of payment has already been made.'))
    9711021                  self.redirect(self.url(self.context))
    9721022                  return
     
    9821032        payment.surcharge_3 = pay_details['surcharge_3']
    9831033        self.context[payment.p_id] = payment
    984         self.flash('Payment ticket created.')
     1034        self.flash(_('Payment ticket created.'))
    9851035        self.redirect(self.url(self.context))
    9861036        return
     
    10011051    @property
    10021052    def label(self):
    1003         return '%s: Online Payment Ticket %s' % (
    1004             self.context.getStudent().display_fullname,self.context.p_id)
     1053        return _('${a}: Online Payment Ticket ${b}', mapping = {
     1054            'a':self.context.getStudent().display_fullname,
     1055            'b':self.context.p_id})
    10051056
    10061057class OnlinePaymentCallbackPage(UtilityView, grok.View):
     
    10161067    def update(self):
    10171068        if self.context.p_state == 'paid':
    1018             self.flash('This ticket has already been paid.')
     1069            self.flash(_('This ticket has already been paid.'))
    10191070            return
    10201071        student = self.context.getStudent()
     
    10291080            pin, error = create_accesscode('CLR',0,student.student_id)
    10301081            if error:
    1031                 self.flash('Valid callback received. ' + error)
     1082                self.flash(_('Valid callback received. ${a}',
     1083                    mapping = {'a':error}))
    10321084                return
    10331085            self.context.ac = pin
     
    10361088            pin, error = create_accesscode('SFE',0,student.student_id)
    10371089            if error:
    1038                 self.flash('Valid callback received. ' + error)
     1090                self.flash(_('Valid callback received. ${a}',
     1091                    mapping = {'a':error}))
    10391092                return
    10401093            self.context.ac = pin
     
    10431096            pin, error = create_accesscode('HOS',0,student.student_id)
    10441097            if error:
    1045                 self.flash('Valid callback received. ' + error)
     1098                self.flash(_('Valid callback received. ${a}',
     1099                    mapping = {'a':error}))
    10461100                return
    10471101            self.context.ac = pin
    1048         self.flash('Valid callback received.')
     1102        self.flash(_('Valid callback received.'))
    10491103        return
    10501104
     
    10921146    grok.template('accommodationmanagepage')
    10931147    pnav = 4
    1094     officers_only_actions = ['Remove selected']
     1148    officers_only_actions = [_('Remove selected')]
    10951149
    10961150    @property
    10971151    def label(self):
    1098         return '%s: Accommodation' % self.context.__parent__.display_fullname
     1152        return _('${a}: Accommodation',
     1153            mapping = {'a':self.context.__parent__.display_fullname})
    10991154
    11001155    def update(self):
     
    11041159        return
    11051160
    1106     @jsaction('Remove selected')
     1161    @jsaction(_('Remove selected'))
    11071162    def delBedTickets(self, **data):
    11081163        if getattr(self.request.principal, 'user_type', None) == 'student':
    1109             self.flash('You are not allowed to remove bed tickets.')
     1164            self.flash(_('You are not allowed to remove bed tickets.'))
    11101165            self.redirect(self.url(self.context))
    11111166            return
     
    11141169            child_id = form['val_id']
    11151170        else:
    1116             self.flash('No bed ticket selected.')
     1171            self.flash(_('No bed ticket selected.'))
    11171172            self.redirect(self.url(self.context))
    11181173            return
     
    11241179            deleted.append(id)
    11251180        if len(deleted):
    1126             self.flash('Successfully removed: %s' % ', '.join(deleted))
     1181            self.flash(_('Successfully removed: ${a}',
     1182                mapping = {'a':', '.join(deleted)}))
    11271183            write_log_message(self,'removed: % s' % ', '.join(deleted))
    11281184        self.redirect(self.url(self.context))
     
    11441200    grok.template('enterpin')
    11451201    ac_prefix = 'HOS'
    1146     label = 'Add bed ticket'
    1147     pnav = 4
    1148     buttonname = 'Create bed ticket'
     1202    label = _('Add bed ticket')
     1203    pnav = 4
     1204    buttonname = _('Create bed ticket')
    11491205    notice = ''
    11501206
     
    11541210        acc_details  = students_utils.getAccommodationDetails(student)
    11551211        if not acc_details:
    1156             self.flash("Your data are incomplete.")
     1212            self.flash(_("Your data are incomplete."))
    11571213            self.redirect(self.url(self.context))
    11581214            return
    11591215        if not student.state in acc_details['allowed_states']:
    1160             self.flash("You are in the wrong registration state.")
     1216            self.flash(_("You are in the wrong registration state."))
    11611217            self.redirect(self.url(self.context))
    11621218            return
     
    11641220            'booking_session']:
    11651221            self.flash(
    1166                 'Your current session does not match accommodation session.')
     1222                _('Your current session does not match accommodation session.'))
    11671223            self.redirect(self.url(self.context))
    11681224            return
    11691225        if str(acc_details['booking_session']) in self.context.keys():
    11701226            self.flash(
    1171                 'You already booked a bed space in current '
    1172                 'accommodation session.')
     1227                _('You already booked a bed space in current ' \
     1228                    + 'accommodation session.'))
    11731229            self.redirect(self.url(self.context))
    11741230            return
     
    11801236        code = get_access_code(pin)
    11811237        if not code:
    1182             self.flash('Activation code is invalid.')
     1238            self.flash(_('Activation code is invalid.'))
    11831239            return
    11841240        # Search and book bed
     
    12001256                bed.bookBed(student.student_id)
    12011257            else:
    1202                 self.flash('There is no free bed in your category %s.'
    1203                             % acc_details['bt'])
     1258                self.flash(_('There is no free bed in your category ${a}.',
     1259                    mapping = {'a':acc_details['bt']}))
    12041260                return
    12051261        # Mark pin as used (this also fires a pin related transition)
    12061262        if code.state == USED:
    1207             self.flash('Activation code has already been used.')
     1263            self.flash(_('Activation code has already been used.'))
    12081264            return
    12091265        else:
    1210             comment = u"AC invalidated for %s" % (
    1211                 self.context.getStudent().student_id,)
     1266            comment = _(u'invalidated')
    12121267            # Here we know that the ac is in state initialized so we do not
    12131268            # expect an exception, but the owner might be different
    12141269            if not invalidate_accesscode(
    12151270                pin,comment,self.context.getStudent().student_id):
    1216                 self.flash('You are not the owner of this access code.')
     1271                self.flash(_('You are not the owner of this access code.'))
    12171272                return
    12181273        # Create bed ticket
     
    12251280        coordinates = bed.getBedCoordinates()[1:]
    12261281        block, room_nr, bed_nr = coordinates
    1227         bedticket.bed_coordinates = '%s, Block %s, Room %s, Bed %s (%s)' % (
    1228             hall_title, block, room_nr, bed_nr, bed.bed_type)
     1282        bc = _('${a}, Block ${b}, Room ${c}, Bed ${d} (${e})', mapping = {
     1283            'a':hall_title, 'b':block,
     1284            'c':room_nr, 'd':bed_nr,
     1285            'e':bed.bed_type})
     1286        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     1287        bedticket.bed_coordinates = translate(
     1288            bc, 'waeup.sirp',target_language=portal_language)
    12291289        key = str(acc_details['booking_session'])
    12301290        self.context[key] = bedticket
    1231         self.flash('Bed ticket created and bed booked: %s'
    1232             % bedticket.bed_coordinates)
     1291        self.flash(_('Bed ticket created and bed booked: ${a}',
     1292            mapping = {'a':bedticket.bed_coordinates}))
    12331293        self.redirect(self.url(self.context))
    12341294        return
     
    12471307    @property
    12481308    def label(self):
    1249         return 'Bed Ticket for Session %s' % self.context.getSessionString()
     1309        return _('Bed Ticket for Session ${a}',
     1310            mapping = {'a':self.context.getSessionString()})
    12501311
    12511312class ExportPDFBedTicketSlipPage(UtilityView, grok.View):
     
    12581319    form_fields['booking_date'].custom_widget = FriendlyDateDisplayWidget('le')
    12591320    prefix = 'form'
    1260     title = 'Bed Allocation Data'
     1321
     1322    @property
     1323    def title(self):
     1324        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     1325        return translate(_('Bed Allocation Data'), 'waeup.sirp',
     1326            target_language=portal_language)
    12611327
    12621328    @property
    12631329    def label(self):
    1264         return 'Bed Allocation: %s' % self.context.bed_coordinates
     1330        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     1331        return translate(_('Bed Allocation: '),
     1332            'waeup.sirp', target_language=portal_language) \
     1333            + ' %s' % self.context.bed_coordinates
    12651334
    12661335    def render(self):
     
    12871356        if self.context.bed != None and \
    12881357              'reserved' in self.context.bed.bed_type:
    1289             self.flash("Students in reserved beds can't be relocated.")
     1358            self.flash(_("Students in reserved beds can't be relocated."))
    12901359            self.redirect(self.url(self.context))
    12911360            return
     
    12931362                self.context.bed != None and \
    12941363                self.context.bed.bed_type == self.context.bed_type:
    1295             self.flash("Student can't be relocated.")
     1364            self.flash(_("Student can't be relocated."))
    12961365            self.redirect(self.url(self.context))
    12971366            return
     
    13151384                new_bed.bookBed(student.student_id)
    13161385            else:
    1317                 self.flash('There is no free bed in your category %s.'
    1318                             % acc_details['bt'])
     1386                self.flash(_('There is no free bed in your category ${a}.',
     1387                    mapping = {'a':acc_details['bt']}))
    13191388                self.redirect(self.url(self.context))
    13201389                return
     
    13291398        coordinates = new_bed.getBedCoordinates()[1:]
    13301399        block, room_nr, bed_nr = coordinates
    1331         self.context.bed_coordinates = '%s, Block %s, Room %s, Bed %s (%s)' % (
    1332             hall_title, block, room_nr, bed_nr, new_bed.bed_type)
    1333         self.flash('Student relocated: %s' % self.context.bed_coordinates)
     1400        bc = _('${a}, Block ${b}, Room ${c}, Bed ${d} (${e})', mapping = {
     1401            'a':hall_title, 'b':block,
     1402            'c':room_nr, 'd':bed_nr,
     1403            'e':new_bed.bed_type})
     1404        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     1405        self.context.bed_coordinates = translate(
     1406            bc, 'waeup.sirp',target_language=portal_language)
     1407        self.flash(_('Student relocated: ${a}',
     1408            mapping = {'a':self.context.bed_coordinates}))
    13341409        self.redirect(self.url(self.context))
    13351410        return
     
    13491424    @property
    13501425    def label(self):
    1351         return '%s: History' % self.context.display_fullname
     1426        return _('${a}: History', mapping = {'a':self.context.display_fullname})
    13521427
    13531428# Pages for students only
     
    13611436    form_fields = grok.AutoFields(IStudentBase).select(
    13621437        'email', 'phone')
    1363     label = 'Edit base data'
    1364     pnav = 4
    1365 
    1366     @action('Save', style='primary')
     1438    label = _('Edit base data')
     1439    pnav = 4
     1440
     1441    @action(_('Save'), style='primary')
    13671442    def save(self, **data):
    13681443        msave(self, **data)
     
    13761451    grok.require('waeup.handleStudent')
    13771452    grok.template('change_password')
    1378     label = 'Change password'
    1379     pnav = 4
    1380 
    1381     @action('Save', style='primary')
     1453    label = _('Change password')
     1454    pnav = 4
     1455
     1456    @action(_('Save'), style='primary')
    13821457    def save(self, **data):
    13831458        form = self.request.form
     
    13901465                IUserAccount(self.context).setPassword(password)
    13911466                write_log_message(self, 'saved: password')
    1392                 self.flash('Password changed.')
     1467                self.flash(_('Password changed.'))
    13931468            else:
    13941469                self.flash( ' '.join(errors))
     
    14021477    grok.require('waeup.uploadStudentFile')
    14031478    grok.template('filesuploadpage')
    1404     label = 'Upload portrait'
     1479    label = _('Upload portrait')
    14051480    pnav = 4
    14061481
     
    14171492    grok.require('waeup.handleStudent')
    14181493    grok.template('enterpin')
    1419     label = 'Start clearance'
     1494    label = _('Start clearance')
    14201495    ac_prefix = 'CLR'
    14211496    notice = ''
    14221497    pnav = 4
    1423     buttonname = 'Start clearance now'
     1498    buttonname = _('Start clearance now')
    14241499
    14251500    @property
     
    14381513    def update(self, SUBMIT=None):
    14391514        if not self.context.state == ADMITTED:
    1440             self.flash("Wrong state.")
     1515            self.flash(_("Wrong state."))
    14411516            self.redirect(self.url(self.context))
    14421517            return
    14431518        if not self.portrait_uploaded:
    1444             self.flash("No portrait uploaded.")
     1519            self.flash(_("No portrait uploaded."))
    14451520            self.redirect(self.url(self.context, 'change_portrait'))
    14461521            return
    14471522        if not self.all_required_fields_filled:
    1448             self.flash("Not all required fields filled.")
     1523            self.flash(_("Not all required fields filled."))
    14491524            self.redirect(self.url(self.context, 'edit_base'))
    14501525            return
     
    14571532        code = get_access_code(pin)
    14581533        if not code:
    1459             self.flash('Activation code is invalid.')
     1534            self.flash(_('Activation code is invalid.'))
    14601535            return
    14611536        # Mark pin as used (this also fires a pin related transition)
    14621537        # and fire transition start_clearance
    14631538        if code.state == USED:
    1464             self.flash('Activation code has already been used.')
     1539            self.flash(_('Activation code has already been used.'))
    14651540            return
    14661541        else:
    1467             comment = u"AC invalidated for %s" % self.context.student_id
     1542            comment = _(u"invalidated")
    14681543            # Here we know that the ac is in state initialized so we do not
    14691544            # expect an exception, but the owner might be different
    14701545            if not invalidate_accesscode(pin,comment,self.context.student_id):
    1471                 self.flash('You are not the owner of this access code.')
     1546                self.flash(_('You are not the owner of this access code.'))
    14721547                return
    14731548            self.context.clr_code = pin
    14741549        IWorkflowInfo(self.context).fireTransition('start_clearance')
    1475         self.flash('Clearance process has been started.')
     1550        self.flash(_('Clearance process has been started.'))
    14761551        self.redirect(self.url(self.context,'cedit'))
    14771552        return
     
    14851560    form_fields = grok.AutoFields(
    14861561        IStudentClearance).omit('clearance_locked')
    1487     label = 'Edit clearance data'
     1562    label = _('Edit clearance data')
    14881563    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
    14891564
     
    14941569        return super(StudentClearanceEditFormPage, self).update()
    14951570
    1496     @action('Save', style='primary')
     1571    @action(_('Save'), style='primary')
    14971572    def save(self, **data):
    14981573        self.applyData(self.context, **data)
    1499         self.flash('Clearance form has been saved.')
     1574        self.flash(_('Clearance form has been saved.'))
    15001575        return
    15011576
     
    15051580        return False
    15061581
    1507     @action('Save and request clearance', style='primary')
     1582    @action(_('Save and request clearance'), style='primary')
    15081583    def requestClearance(self, **data):
    15091584        self.applyData(self.context, **data)
     
    15111586            self.flash(self.dataNotComplete())
    15121587            return
    1513         self.flash('Clearance form has been saved.')
     1588        self.flash(_('Clearance form has been saved.'))
    15141589        self.redirect(self.url(self.context,'request_clearance'))
    15151590        return
     
    15201595    grok.require('waeup.handleStudent')
    15211596    grok.template('enterpin')
    1522     label = 'Request clearance'
    1523     notice = 'Enter the CLR access code used for starting clearance.'
     1597    label = _('Request clearance')
     1598    notice = _('Enter the CLR access code used for starting clearance.')
    15241599    ac_prefix = 'CLR'
    15251600    pnav = 4
    1526     buttonname = 'Request clearance now'
     1601    buttonname = _('Request clearance now')
    15271602
    15281603    def update(self, SUBMIT=None):
     
    15331608        pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number)
    15341609        if self.context.clr_code != pin:
    1535             self.flash("This isn't your CLR access code.")
     1610            self.flash(_("This isn't your CLR access code."))
    15361611            return
    15371612        state = IWorkflowState(self.context).getState()
     
    15391614        # might have forgotten to lock the form after changing the state
    15401615        if state != CLEARANCE:
    1541             self.flash('This form cannot be submitted. Wrong state!')
     1616            self.flash(_('This form cannot be submitted. Wrong state!'))
    15421617            return
    15431618        IWorkflowInfo(self.context).fireTransition('request_clearance')
    1544         self.flash('Clearance has been requested.')
     1619        self.flash(_('Clearance has been requested.'))
    15451620        self.redirect(self.url(self.context))
    15461621        return
     
    15511626    grok.require('waeup.handleStudent')
    15521627    grok.template('enterpin')
    1553     label = 'Start course registration'
     1628    label = _('Start course registration')
    15541629    ac_prefix = 'SFE'
    15551630    notice = ''
    15561631    pnav = 4
    1557     buttonname = 'Start course registration now'
     1632    buttonname = _('Start course registration now')
    15581633
    15591634    def update(self, SUBMIT=None):
    15601635        if not self.context.getStudent().state in (CLEARED,RETURNING):
    1561             self.flash("Wrong state.")
     1636            self.flash(_("Wrong state."))
    15621637            self.redirect(self.url(self.context))
    15631638            return
     
    15701645        code = get_access_code(pin)
    15711646        if not code:
    1572             self.flash('Activation code is invalid.')
     1647            self.flash(_('Activation code is invalid.'))
    15731648            return
    15741649        # Mark pin as used (this also fires a pin related transition)
    15751650        # and fire transition start_clearance
    15761651        if code.state == USED:
    1577             self.flash('Activation code has already been used.')
     1652            self.flash(_('Activation code has already been used.'))
    15781653            return
    15791654        else:
    1580             comment = u"AC invalidated for %s" % (
    1581                 self.context.getStudent().student_id,)
     1655            comment = _(u"invalidated")
    15821656            # Here we know that the ac is in state initialized so we do not
    15831657            # expect an exception, but the owner might be different
    15841658            if not invalidate_accesscode(
    15851659                pin,comment,self.context.getStudent().student_id):
    1586                 self.flash('You are not the owner of this access code.')
     1660                self.flash(_('You are not the owner of this access code.'))
    15871661                return
    15881662        if self.context.getStudent().state == CLEARED:
     
    15921666            IWorkflowInfo(self.context.getStudent()).fireTransition(
    15931667                'pay_school_fee')
    1594         self.flash('Course registration has been started.')
     1668        self.flash(_('Course registration has been started.'))
    15951669        self.redirect(self.url(self.context))
    15961670        return
     
    16111685        code = self.context.current_level
    16121686        title = studylevelsource.getTitle(self.context, code)
    1613         return 'Add current level %s' % title
     1687        return _('Add current level ${a}', mapping = {'a':title})
    16141688
    16151689    def update(self):
     
    16201694        return
    16211695
    1622     @action('Create course list now', style='primary')
     1696    @action(_('Create course list now'), style='primary')
    16231697    def addStudyLevel(self, **data):
    16241698        studylevel = StudentStudyLevel()
     
    16291703                self.context.certificate,studylevel)
    16301704        except KeyError:
    1631             self.flash('This level exists.')
     1705            self.flash(_('This level exists.'))
    16321706        self.redirect(self.url(self.context))
    16331707        return
     
    16551729    @property
    16561730    def label(self):
    1657         return 'Add and remove course tickets of study level %s' % (
    1658             self.context.level_title,)
     1731        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     1732        lang = self.request.cookies.get('sirp.language', portal_language)
     1733        level_title = translate(self.context.level_title, 'waeup.sirp',
     1734            target_language=lang)
     1735        return _('Add and remove course tickets of study level ${a}',
     1736            mapping = {'a':level_title})
    16591737
    16601738    @property
     
    16651743        return total_credits
    16661744
    1667     @action('Add course ticket')
     1745    @action(_('Add course ticket'))
    16681746    def addCourseTicket(self, **data):
    16691747        self.redirect(self.url(self.context, 'ctadd'))
    16701748
    1671     @jsaction('Remove selected tickets')
     1749    @jsaction(_('Remove selected tickets'))
    16721750    def delCourseTicket(self, **data):
    16731751        form = self.request.form
     
    16751753            child_id = form['val_id']
    16761754        else:
    1677             self.flash('No ticket selected.')
     1755            self.flash(_('No ticket selected.'))
    16781756            self.redirect(self.url(self.context, '@@edit'))
    16791757            return
     
    16841762            # Students are not allowed to remove core tickets
    16851763            if not self.context[id].mandatory:
    1686                 try:
    1687                     del self.context[id]
    1688                     deleted.append(id)
    1689                 except:
    1690                     self.flash('Could not delete %s: %s: %s' % (
    1691                             id, sys.exc_info()[0], sys.exc_info()[1]))
     1764                del self.context[id]
     1765                deleted.append(id)
    16921766        if len(deleted):
    1693             self.flash('Successfully removed: %s' % ', '.join(deleted))
     1767            self.flash(_('Successfully removed: ${a}',
     1768                mapping = {'a':', '.join(deleted)}))
    16941769        self.redirect(self.url(self.context, u'@@edit'))
    16951770        return
    16961771
    1697     @action('Register course list', style='primary')
     1772    @action(_('Register course list'), style='primary')
    16981773    def RegisterCourses(self, **data):
    16991774        IWorkflowInfo(self.context.getStudent()).fireTransition(
    17001775            'register_courses')
    1701         self.flash('Course list has been registered.')
     1776        self.flash(_('Course list has been registered.'))
    17021777        self.redirect(self.url(self.context))
    17031778        return
     
    17181793        return
    17191794
    1720     @action('Add course ticket')
     1795    @action(_('Add course ticket'))
    17211796    def addCourseTicket(self, **data):
    17221797        # Safety belt
     
    17311806            self.context.addCourseTicket(ticket)
    17321807        except KeyError:
    1733             self.flash('The ticket exists.')
    1734             return
    1735         self.flash('Successfully added %s.' % ticket.code)
     1808            self.flash(_('The ticket exists.'))
     1809            return
     1810        self.flash(_('Successfully added ${a}.',
     1811            mapping = {'a':ticket.code}))
    17361812        self.redirect(self.url(self.context, u'@@edit'))
    17371813        return
     
    17441820    grok.require('waeup.Anonymous')
    17451821    grok.template('changepw')
    1746     label = 'Change my password'
     1822    label = _('Change my password')
    17471823    form_fields = grok.AutoFields(IStudentChangePassword)
    17481824
     
    17541830        return
    17551831
    1756     @action('Get new login credentials', style='primary')
     1832    @action(_('Get new login credentials'), style='primary')
    17571833    def request(self, **data):
    17581834        if not self.captcha_result.is_valid:
     
    17681844            email=(email,email))
    17691845        if len(results) == 0:
    1770             self.flash('No student record found.')
     1846            self.flash(_('No student record found.'))
    17711847            return
    17721848        student = list(results)[0]
     
    17811857            IUserAccount(student),pwd,login_url,msg)
    17821858        if success:
    1783             self.flash('An email with your user name and password ' +
    1784                 'has been sent to %s.' % email)
     1859            self.flash(_('An email with your user name and password ' +
     1860                'has been sent to ${a}.', mapping = {'a':email}))
    17851861        else:
    1786             self.flash('An smtp server error occurred.')
     1862            self.flash(_('An smtp server error occurred.'))
    17871863        return
    17881864
     
    17921868    grok.require('waeup.Anonymous')
    17931869    grok.template('setpassword')
    1794     label = 'Set password for first-time login'
     1870    label = _('Set password for first-time login')
    17951871    ac_prefix = 'PWD'
    17961872    pnav = 0
     
    18061882            searchtype='reg_number', view=self)
    18071883        if not hitlist:
    1808             self.flash('No student found.')
     1884            self.flash(_('No student found.'))
    18091885            return
    18101886        if len(hitlist) != 1:   # Cannot happen but anyway
    1811             self.flash('More than one student found.')
     1887            self.flash(_('More than one student found.'))
    18121888            return
    18131889        student = hitlist[0].context
     
    18171893        code = get_access_code(pin)
    18181894        if not code:
    1819             self.flash('Access code is invalid.')
     1895            self.flash(_('Access code is invalid.'))
    18201896            return
    18211897        if student_pw and pin == student.adm_code:
    1822             self.flash('Password has already been set. Your Student Id is %s'
    1823                 % self.student_id)
     1898            self.flash(_(
     1899                'Password has already been set. Your Student Id is ${a}',
     1900                mapping = {'a':self.student_id}))
    18241901            return
    18251902        elif student_pw:
    18261903            self.flash(
    1827                 'Password has already been set. You are using the '
    1828                 'wrong Access Code.')
     1904                _('Password has already been set. You are using the ' +
     1905                'wrong Access Code.'))
    18291906            return
    18301907        # Mark pin as used (this also fires a pin related transition)
    18311908        # and set student password
    18321909        if code.state == USED:
    1833             self.flash('Access code has already been used.')
     1910            self.flash(_('Access code has already been used.'))
    18341911            return
    18351912        else:
    1836             comment = u"AC invalidated for %s" % self.student_id
     1913            comment = _(u"invalidated")
    18371914            # Here we know that the ac is in state initialized so we do not
    18381915            # expect an exception
     
    18401917            IUserAccount(student).setPassword(self.ac_number)
    18411918            student.adm_code = pin
    1842         self.flash('Password has been set. Your Student Id is %s'
    1843             % self.student_id)
    1844         return
     1919        self.flash(_('Password has been set. Your Student Id is ${a}',
     1920            mapping = {'a':self.student_id}))
     1921        return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r7688 r7723  
    2323from waeup.sirp.interfaces import (
    2424    ISIRPObject, academic_sessions_vocab, validate_email, ISIRPUtils)
     25from waeup.sirp.interfaces import MessageFactory as _
    2526from waeup.sirp.schema import TextLineChoice
    2627from waeup.sirp.university.vocabularies import CourseSource, StudyModeSource
     
    146147
    147148    student_id = schema.TextLine(
    148         title = u'Student Id',
     149        title = _(u'Student Id'),
    149150        required = False,
    150151        )
    151152
    152153    firstname = schema.TextLine(
    153         title = u'First Name',
     154        title = _(u'First Name'),
    154155        required = True,
    155156        )
    156157
    157158    middlename = schema.TextLine(
    158         title = u'Middle Name',
     159        title = _(u'Middle Name'),
    159160        required = False,
    160161        )
    161162
    162163    lastname = schema.TextLine(
    163         title = u'Last Name (Surname)',
     164        title = _(u'Last Name (Surname)'),
    164165        required = True,
    165166        )
    166167
    167168    sex = schema.Choice(
    168         title = u'Sex',
     169        title = _(u'Sex'),
    169170        source = GenderSource(),
    170171        default = u'm',
     
    173174
    174175    reg_number = TextLineChoice(
    175         title = u'Registration Number',
     176        title = _(u'Registration Number'),
    176177        required = True,
    177178        readonly = False,
     
    180181
    181182    matric_number = TextLineChoice(
    182         title = u'Matriculation Number',
     183        title = _(u'Matriculation Number'),
    183184        #default = u'',
    184185        required = False,
     
    188189
    189190    adm_code = schema.TextLine(
    190         title = u'PWD Activation Code',
     191        title = _(u'PWD Activation Code'),
    191192        default = u'',
    192193        required = False,
     
    195196
    196197    email = schema.ASCIILine(
    197         title = u'Email',
     198        title = _(u'Email'),
    198199        required = False,
    199200        constraint=validate_email,
    200201        )
    201202    phone = schema.TextLine(
    202         title = u'Phone',
     203        title = _(u'Phone'),
    203204        description = u'',
    204205        required = False,
     
    210211    """
    211212    date_of_birth = schema.Date(
    212         title = u'Date of Birth',
     213        title = _(u'Date of Birth'),
    213214        required = True,
    214215        )
    215216
    216217    clearance_locked = schema.Bool(
    217         title = u'Clearance form locked',
     218        title = _(u'Clearance form locked'),
    218219        default = False,
    219220        )
    220221
    221222    clr_code = schema.TextLine(
    222         title = u'CLR Activation Code',
     223        title = _(u'CLR Activation Code'),
    223224        default = u'',
    224225        required = False,
     
    228229    nationality = schema.Choice(
    229230        source = nats_vocab,
    230         title = u'Nationality',
     231        title = _(u'Nationality'),
    231232        default = 'nigeria',
    232233        required = True,
     
    238239    """
    239240    perm_address = schema.Text(
    240         title = u'Permanent Address',
     241        title = _(u'Permanent Address'),
    241242        required = False,
    242243        )
     
    252253    """
    253254    reg_number = schema.TextLine(
    254         title = u'Registration Number',
     255        title = _(u'Registration Number'),
    255256        default = None,
    256257        required = False,
     
    262263    """
    263264    matric_number = schema.TextLine(
    264         title = u'Matriculation Number',
     265        title = _(u'Matriculation Number'),
    265266        default = None,
    266267        required = False,
     
    272273    """
    273274    certificate = schema.Choice(
    274         title = u'Certificate',
     275        title = _(u'Certificate'),
    275276        source = CertificateSource(),
    276277        default = None,
     
    279280
    280281    entry_mode = schema.Choice(
    281         title = u'Entry Mode',
     282        title = _(u'Entry Mode'),
    282283        source = StudyModeSource(),
    283284        default = u'ug_ft',
     
    287288
    288289    entry_session = schema.Choice(
    289         title = u'Entry Session',
     290        title = _(u'Entry Session'),
    290291        source = academic_sessions_vocab,
    291292        #default = datetime.now().year,
     
    296297
    297298    current_session = schema.Choice(
    298         title = u'Current Session',
     299        title = _(u'Current Session'),
    299300        source = academic_sessions_vocab,
    300301        default = None,
     
    304305
    305306    current_level = schema.Choice(
    306         title = u'Current Level',
     307        title = _(u'Current Level'),
    307308        source = StudyLevelSource(),
    308309        default = None,
     
    312313
    313314    current_verdict = schema.Choice(
    314         title = u'Current Verdict',
     315        title = _(u'Current Verdict'),
    315316        source = VerdictSource(),
    316317        default = '0',
     
    319320
    320321    previous_verdict = schema.Choice(
    321         title = u'Previous Verdict',
     322        title = _(u'Previous Verdict'),
    322323        source = VerdictSource(),
    323324        default = '0',
     
    334335
    335336    level_session = schema.Choice(
    336         title = u'Session',
     337        title = _(u'Session'),
    337338        source = academic_sessions_vocab,
    338339        default = None,
     
    341342
    342343    level_verdict = schema.Choice(
    343         title = u'Verdict',
     344        title = _(u'Verdict'),
    344345        source = VerdictSource(),
    345346        default = '0',
     
    360361
    361362    mandatory = schema.Bool(
    362         title = u'Mandatory',
     363        title = _(u'Mandatory'),
    363364        default = False,
    364365        required = False,
     
    367368
    368369    score = schema.Int(
    369         title = u'Score',
     370        title = _(u'Score'),
    370371        default = 0,
    371372        required = False,
     
    374375
    375376    automatic = schema.Bool(
    376         title = u'Automatical Creation',
     377        title = _(u'Automatical Creation'),
    377378        default = False,
    378379        required = False,
     
    381382
    382383    carry_over = schema.Bool(
    383         title = u'Carry-over Course',
     384        title = _(u'Carry-over Course'),
    384385        default = False,
    385386        required = False,
     
    400401    """
    401402    course = schema.Choice(
    402         title = u'Course',
     403        title = _(u'Course'),
    403404        source = CourseSource(),
    404405        readonly = False,
     
    417418
    418419    bed_coordinates = schema.TextLine(
    419         title = u'Bed Coordinates',
     420        title = _(u'Bed Coordinates'),
    420421        default = None,
    421422        required = False,
     
    424425
    425426    bed_type = schema.TextLine(
    426         title = u'Bed Type',
     427        title = _(u'Bed Type'),
    427428        default = None,
    428429        required = False,
     
    431432
    432433    booking_session = schema.Choice(
    433         title = u'Session',
     434        title = _(u'Session'),
    434435        source = academic_sessions_vocab,
    435436        default = None,
     
    439440
    440441    booking_date = schema.Datetime(
    441         title = u'Booking Date',
     442        title = _(u'Booking Date'),
    442443        required = False,
    443444        readonly = True,
     
    445446
    446447    booking_code = schema.TextLine(
    447         title = u'Booking Activation Code',
     448        title = _(u'Booking Activation Code'),
    448449        default = u'',
    449450        required = False,
     
    466467    """
    467468    p_session = schema.Choice(
    468         title = u'Payment Session',
     469        title = _(u'Payment Session'),
    469470        source = academic_sessions_vocab,
    470471        required = False,
     
    480481
    481482    reg_number = schema.TextLine(
    482         title = u'Registration Number',
     483        title = _(u'Registration Number'),
    483484        default = None,
    484485        required = True,
     
    487488
    488489    email = schema.ASCIILine(
    489         title = u'Email Address',
     490        title = _(u'Email Address'),
    490491        required = True,
    491492        constraint=validate_email,
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7705 r7723  
    865865        self.browser.getLink("Reject clearance").click()
    866866        self.assertTrue('Clearance has been annulled' in self.browser.contents)
    867         urlmessage = 'Clearance+has+been+annulled'
     867        urlmessage = 'Clearance+has+been+annulled.'
    868868        # CO does now see the contact form
    869869        self.assertEqual(self.browser.url, self.student_path +
     
    884884        # clearance requested
    885885        self.browser.open(self.student_path + '/clear')
    886         self.assertTrue('Student is in the wrong state'
     886        self.assertTrue('Student is in wrong state'
    887887            in self.browser.contents)
    888888        # The CO can go to his department throug the my_roles page
     
    968968        self.assertTrue('courses validated' in self.browser.contents)
    969969        self.browser.getLink("Reject courses").click()
    970         self.assertTrue('Course list request has been annulled'
     970        self.assertTrue('Course list request has been annulled.'
    971971            in self.browser.contents)
    972         urlmessage = 'Course+list+request+has+been+annulled'
     972        urlmessage = 'Course+list+request+has+been+annulled.'
    973973        self.assertEqual(self.browser.url, self.student_path +
    974974            '/contactstudent?subject=%s' % urlmessage)
Note: See TracChangeset for help on using the changeset viewer.