Changeset 7691 for main


Ignore:
Timestamp:
23 Feb 2012, 15:53:39 (13 years ago)
Author:
Henrik Bettermann
Message:

Translate StudyLevelSource?. Unfortunately, unittests don't know about i18n.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_vocabularies.py

    r7625 r7691  
    3737        self.assertEqual(values, [100, 110, 120, 200, 210, 220, 300, 310, 320,
    3838            400, 410, 420, 500, 510, 520, 600, 610, 620])
     39        # Unfortunately, unittests don't know about internationalization
    3940        self.assertEqual(studylevelsource.getTitle(studycourse, None),
    40             'Error: level id None out of range')
     41            'Error: level id ${value} out of range')
    4142        self.assertEqual(studylevelsource.getTitle(studycourse, 0),
    42             'Error: level id 0 out of range')
     43            'Error: level id ${value} out of range')
    4344        self.assertEqual(studylevelsource.getTitle(studycourse, 10),
    44             'Error: level id 10 out of range')
     45            'Error: level id ${value} out of range')
    4546        self.assertEqual(studylevelsource.getTitle(studycourse, 100),
    4647            '100 (Year 1)')
    4748        self.assertEqual(studylevelsource.getTitle(studycourse, 110),
    48             '100 (Year 1) on 1st probation')
     49            '${title} on 1st probation')
    4950        self.assertEqual(studylevelsource.getTitle(studycourse, 120),
    50             '100 (Year 1) on 2nd probation')
     51            '${title} on 2nd probation')
    5152        self.assertEqual(studylevelsource.getTitle(studycourse, 500),
    5253            '500 (Year 5)')
    5354        self.assertEqual(studylevelsource.getTitle(studycourse, 600),
    54             '500 (Year 5) 1st spillover')
     55            '${title} 1st spillover')
    5556        self.assertEqual(studylevelsource.getTitle(studycourse, 610),
    56             '500 (Year 5) 2nd spillover')
     57            '${title} 2nd spillover')
    5758        self.assertEqual(studylevelsource.getTitle(studycourse, 620),
    58             '500 (Year 5) 3rd spillover')
     59            '${title} 3rd spillover')
    5960        self.assertEqual(studylevelsource.getTitle(studycourse, 630),
    60             'Error: level id 630 out of range')
     61            'Error: level id ${value} out of range')
    6162        self.assertEqual(studylevelsource.getTitle(studycourse, 700),
    62             'Error: level id 700 out of range')
     63            'Error: level id ${value} out of range')
    6364        # Now we change the certificates start_level to pre-studies
    6465        studycourse.certificate.start_level = 10
  • main/waeup.sirp/trunk/src/waeup/sirp/students/vocabularies.py

    r7625 r7691  
    2626from zc.sourcefactory.contextual import BasicContextualSourceFactory
    2727from waeup.sirp.interfaces import SimpleSIRPVocabulary
     28from waeup.sirp.interfaces import MessageFactory as _
    2829from waeup.sirp.students.lgas import LGAS
    2930from waeup.sirp.students.nats import NATS
     
    7475            end_level = 600
    7576        if value < start_level or value > end_level + 120:
    76             return "Error: level id %s out of range" % value
     77            return _('Error: level id ${value} out of range',
     78                mapping={'value': value})
    7779        # Special treatment for pre-studies level
    7880        if value == 10:
     
    8486        if level > end_level and repeat == 1:
    8587            title = course_levels.by_value[level - 100].title
    86             return "%s 2nd spillover" % title
     88            return _('${title} 2nd spillover', mapping={'title': title})
    8789        if level > end_level and repeat == 2:
    8890            title = course_levels.by_value[level - 100].title
    89             return "%s 3rd spillover" % title
     91            return _('${title} 3rd spillover', mapping={'title': title})
    9092        if level > end_level:
    9193            title = course_levels.by_value[level - 100].title
    92             return  "%s 1st spillover" % title
     94            return  _('${title} 1st spillover', mapping={'title': title})
    9395        if repeat == 1:
    94             return "%s on 1st probation" % title
     96            return _('${title} on 1st probation', mapping={'title': title})
    9597        if repeat == 2:
    96             return "%s on 2nd probation" % title
     98            return _('${title} on 2nd probation', mapping={'title': title})
    9799        return title
    98100
     
    131133    def getTitle(self, value):
    132134        if value == 'm':
    133             return 'Male'
     135            return _('Male')
    134136        if value == 'f':
    135             return 'Female'
     137            return _('Female')
    136138
    137139class RegNumNotInSource(ValidationError):
Note: See TracChangeset for help on using the changeset viewer.