Example #1
0
 def has_translation(self):
     title = get_translation('page', 'title', self.id)
     body = get_translation('page', 'body', self.id)
     teaser = get_translation('page', 'teaser', self.id)
     if title or body or teaser:
         return True
     return False
Example #2
0
 def trans_title(self):
     translation = get_translation('PageLink', 'title', self.id)
     if translation:
         return translation
     elif self.title:
         return self.title
     else:
         for lang, translation in get_translations('PageLink', 'title',
                                                   self.id).items():
             if translation:
                 return translation
     return ''
Example #3
0
 def trans_teaser(self):
     translation = get_translation('Page', 'body', self.id)
     if translation:
         return strip_tags(translation)[:400] + '...'
     elif self.title:
         return strip_tags(self.body)[:400] + '...'
     else:
         for lang, translation in get_translations('Page', 'body',
                                                   self.id).items():
             if translation:
                 return strip_tags(translation)[:400] + '...'
     return ''
Example #4
0
 def trans_body(self):
     translation = get_translation('Page', 'body', self.id)
     if translation:
         return translation
     elif self.title:
         return self.body
     else:
         for lang, translation in get_translations('Page', 'body',
                                                   self.id).items():
             if translation:
                 return translation
     return ''
Example #5
0
 def trans_title(self):
     translation = get_translation('PageCategory', 'title', self.id)
     if translation:
         return translation
     else:
         return self.title
Example #6
0
 def trans_only_body(self):
     translation = get_translation('page', 'body', self.id)
     if translation:
         return translation
     else:
         return ''
Example #7
0
 def trans_only_title(self):
     translation = get_translation('page', 'title', self.id)
     if translation:
         return translation
     else:
         return ''
Example #8
0
 def trans_teaser(self):
     translation = get_translation('page', 'teaser', self.id)
     if translation:
         return translation
     else:
         return self.teaser