Index: main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py	(revision 10260)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py	(revision 10261)
@@ -62,5 +62,5 @@
     return translate(text, 'waeup.kofa', target_language=lang)
 
-def formatted_text(text, color=FONT_COLOR):
+def formatted_text(text, color=FONT_COLOR, lang='en'):
     """Turn `text`, `color` and `size` into an HTML snippet.
 
@@ -76,9 +76,4 @@
     The returned snippet is unicode type.
     """
-    try:
-        # In unit tests IKofaUtils has not been registered
-        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
-    except:
-        portal_language = 'en'
     if not isinstance(text, unicode):
         if isinstance(text, basestring):
@@ -90,5 +85,5 @@
     # Mainly for boolean values we need our customized
     # localisation of the zope domain
-    text = translate(text, 'zope', target_language=portal_language)
+    text = translate(text, 'zope', target_language=lang)
     text = text.replace('</div>', '<br /></div>')
     tag1 = u'<font color="%s">' % (color)
@@ -108,5 +103,5 @@
         )
 
-def render_student_data(studentview, omit_fields=()):
+def render_student_data(studentview, omit_fields=(), lang='en'):
     """Render student table for an existing frame.
     """
@@ -124,7 +119,6 @@
     data_left.append([doc_img])
     #data.append([Spacer(1, 12)])
-    portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
-
-    f_label = _('Name:')
+
+    f_label = trans(_('Name:'), lang)
     f_label = Paragraph(f_label, ENTRY1_STYLE)
     f_text = formatted_text(studentview.context.display_fullname)
@@ -137,7 +131,7 @@
         f_label = translate(
             widget.label.strip(), 'waeup.kofa',
-            target_language=portal_language)
+            target_language=lang)
         f_label = Paragraph('%s:' % f_label, ENTRY1_STYLE)
-        f_text = formatted_text(widget())
+        f_text = formatted_text(widget(), lang=lang)
         f_text = Paragraph(f_text, ENTRY1_STYLE)
         data_right.append([f_label,f_text])
@@ -145,5 +139,5 @@
     if getattr(studentview.context, 'certcode', None):
         if not 'certificate' in omit_fields:
-            f_label = _('Study Course:')
+            f_label = trans(_('Study Course:'), lang)
             f_label = Paragraph(f_label, ENTRY1_STYLE)
             f_text = formatted_text(
@@ -152,5 +146,5 @@
             data_right.append([f_label,f_text])
         if not 'department' in omit_fields:
-            f_label = _('Department:')
+            f_label = trans(_('Department:'), lang)
             f_label = Paragraph(f_label, ENTRY1_STYLE)
             f_text = formatted_text(
@@ -161,5 +155,5 @@
             data_right.append([f_label,f_text])
         if not 'faculty' in omit_fields:
-            f_label = _('Faculty:')
+            f_label = trans(_('Faculty:'), lang)
             f_label = Paragraph(f_label, ENTRY1_STYLE)
             f_text = formatted_text(
@@ -170,5 +164,5 @@
             data_right.append([f_label,f_text])
         if not 'entry_session' in omit_fields:
-            f_label = _('Entry Session: ')
+            f_label = trans(_('Entry Session:'), lang)
             f_label = Paragraph(f_label, ENTRY1_STYLE)
             entry_session = studentview.context['studycourse'].entry_session
@@ -178,5 +172,5 @@
             data_right.append([f_label,f_text])
         if not 'date_of_birth' in omit_fields:
-            f_label = _('Date of Birth: ')
+            f_label = trans(_('Date of Birth:'), lang)
             f_label = Paragraph(f_label, ENTRY1_STYLE)
             date_of_birth = studentview.context.date_of_birth
@@ -194,5 +188,5 @@
     return table
 
-def render_table_data(tableheader,tabledata):
+def render_table_data(tableheader, tabledata, lang='en'):
     """Render children table for an existing frame.
     """
@@ -202,5 +196,5 @@
     style = getSampleStyleSheet()
     for element in tableheader:
-        field = '<strong>%s</strong>' % formatted_text(element[0])
+        field = '<strong>%s</strong>' % formatted_text(element[0], lang=lang)
         field = Paragraph(field, style["Normal"])
         line.append(field)
@@ -217,5 +211,5 @@
     return table
 
-def render_transcript_data(view,tableheader,levels_data):
+def render_transcript_data(view, tableheader, levels_data, lang='en'):
     """Render children table for an existing frame.
     """
@@ -228,6 +222,8 @@
         headerline = []
         tabledata = []
-        subheader = 'Session %s, Level %s' % (
+        subheader = '%s %s, %s %s' % (
+            trans(_('Session'), lang),
             view.session_dict[level_obj.level_session],
+            trans(_('Level'), lang),
             view.course_levels.getTerm(level_obj.level).title)
         data.append(Paragraph(subheader, HEADING_STYLE))
@@ -247,4 +243,6 @@
             element[2]*cm for element in tableheader], style=CONTENT_STYLE)
         data.append(table)
+        sgpa = '%s: %s' % (trans('Sessional GPA', lang), level['sgpa'])
+        data.append(Paragraph(sgpa, style["Normal"]))
     return data
 
@@ -551,5 +549,5 @@
 
         # Student data
-        data.append(render_student_data(view, omit_fields))
+        data.append(render_student_data(view, omit_fields, lang=portal_language))
 
         # Insert history
@@ -589,4 +587,5 @@
         """Render pdf slips for various pages.
         """
+        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
         # XXX: tell what the different parameters mean
         style = getSampleStyleSheet()
@@ -607,14 +606,13 @@
 
         # Insert student data table
-        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
         if student is not None:
             bd_translation = trans(_('Base Data'), portal_language)
             data.append(Paragraph(bd_translation, HEADING_STYLE))
-            data.append(render_student_data(studentview, omit_fields))
+            data.append(render_student_data(
+                studentview, omit_fields, lang=portal_language))
 
         # Insert widgets
         if view.form_fields:
             data.append(Paragraph(view.title, HEADING_STYLE))
-            portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
             separators = getattr(self, 'SEPARATORS_DICT', {})
             table = creator.getWidgetsTable(
@@ -691,4 +689,5 @@
         """Render pdf slips for transcript.
         """
+        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
         # XXX: tell what the different parameters mean
         style = getSampleStyleSheet()
@@ -709,9 +708,9 @@
 
         # Insert student data table
-        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
         if student is not None:
             #bd_translation = trans(_('Base Data'), portal_language)
             #data.append(Paragraph(bd_translation, HEADING_STYLE))
-            data.append(render_student_data(studentview, omit_fields))
+            data.append(render_student_data(
+                studentview, omit_fields, lang=portal_language))
 
 
@@ -721,5 +720,5 @@
 
         contextdata = []
-        f_label = _('Course of Study:')
+        f_label = trans(_('Course of Study:'), portal_language)
         f_label = Paragraph(f_label, ENTRY1_STYLE)
         f_text = formatted_text(view.context.certificate.longtitle())
@@ -727,5 +726,5 @@
         contextdata.append([f_label,f_text])
 
-        f_label = _('Faculty:')
+        f_label = trans(_('Faculty:'), portal_language)
         f_label = Paragraph(f_label, ENTRY1_STYLE)
         f_text = formatted_text(
@@ -734,5 +733,5 @@
         contextdata.append([f_label,f_text])
 
-        f_label = _('Department:')
+        f_label = trans(_('Department:'), portal_language)
         f_label = Paragraph(f_label, ENTRY1_STYLE)
         f_text = formatted_text(
@@ -741,5 +740,5 @@
         contextdata.append([f_label,f_text])
 
-        f_label = _('Entry Session:')
+        f_label = trans(_('Entry Session:'), portal_language)
         f_label = Paragraph(f_label, ENTRY1_STYLE)
         f_text = formatted_text(
@@ -748,5 +747,5 @@
         contextdata.append([f_label,f_text])
 
-        f_label = _('Entry Mode:')
+        f_label = trans(_('Entry Mode:'), portal_language)
         f_label = Paragraph(f_label, ENTRY1_STYLE)
         f_text = formatted_text(view.studymode_dict.get(
@@ -755,5 +754,5 @@
         contextdata.append([f_label,f_text])
 
-        f_label = _('Final GPA:')
+        f_label = trans(_('Final GPA:'), portal_language)
         f_label = Paragraph(f_label, ENTRY1_STYLE)
         f_text = formatted_text(gpa)
@@ -765,5 +764,5 @@
 
         transcripttables = render_transcript_data(
-            view, tableheader, levels_data)
+            view, tableheader, levels_data, lang=portal_language)
         data.extend(transcripttables)
 
@@ -786,5 +785,5 @@
                 note=note, sigs_in_footer=sigs_in_footer, topMargin=topMargin)
         except IOError:
-            view.flash('Error in image file.')
+            view.flash(_('Error in image file.'))
             return view.redirect(view.url(view.context))
         return pdf_stream
