diff --git a/gen/model.py b/gen/model.py
index 9bc9c2d..5dd8e6e 100644
--- a/gen/model.py
+++ b/gen/model.py
@@ -183,12 +183,13 @@ class Group(ModelClass):
# The Translation class --------------------------------------------------------
class Translation(ModelClass):
- _appy_attributes = ['po', 'title']
+ _appy_attributes = ['po', 'title', 'sourceLanguage']
# All methods defined below are fake. Real versions are in the wrapper.
+ actionsPage = gen.Page('actions')
def getPoFile(self): pass
- po = gen.Action(action=getPoFile, page=gen.Page('actions', show='view'),
- result='filetmp')
- title = gen.String(show=False, indexed=True)
+ po = gen.Action(action=getPoFile, page=actionsPage, result='filetmp')
+ sourceLanguage = gen.String(page=actionsPage, width=4)
+ title = gen.String(show=False, indexed=True, page=actionsPage)
def label(self): pass
def show(self, name): pass
diff --git a/gen/wrappers/TranslationWrapper.py b/gen/wrappers/TranslationWrapper.py
index d1ed616..acbf4ff 100644
--- a/gen/wrappers/TranslationWrapper.py
+++ b/gen/wrappers/TranslationWrapper.py
@@ -10,7 +10,11 @@ class TranslationWrapper(AbstractWrapper):
'''The label for a text to translate displays the text of the
corresponding message in the source translation.'''
tool = self.tool
- sourceLanguage = self.o.getProductConfig().sourceLanguage
+ # Get the source language: either defined on the translation itself,
+ # either from the config object.
+ sourceLanguage = self.sourceLanguage
+ if not sourceLanguage:
+ sourceLanguage = self.o.getProductConfig().sourceLanguage
sourceTranslation = getattr(tool.o, sourceLanguage).appy()
# p_field is the Computed field. We need to get the name of the
# corresponding field holding the translation message.
@@ -28,9 +32,9 @@ class TranslationWrapper(AbstractWrapper):
if url.endswith('/ui/edit') or url.endswith('/do'):
sourceMsg = sourceMsg.replace('<','<').replace('>','>')
sourceMsg = sourceMsg.replace('\n', '
')
- return '