Esempio n. 1
0
def get_i18n_text(text_id):
    from pylons import tmpl_context as c
    text_obj = LanguageText.get(text_id, c.lang)
    if text_obj is None:
        text_obj = LanguageText.get(text_id, 'en')
    if text_obj is None:
        return ''
    return literal(text_obj.text)
Esempio n. 2
0
 def update_i18n_text(self):
     if hasattr(self, 'form_result'):
         id = self.form_result['id']
         lang = self.form_result['language']
         text = LanguageText.get(id, lang)
         text.text = self.form_result['i18n_text']
         meta.Session.commit()
     redirect(url(controller='admin', action='i18n_texts'))
Esempio n. 3
0
 def edit_i18n_text(self, id, lang):
     c.text = LanguageText.get(id, lang)
     defaults = {
         'id': c.text.id,
         'language': c.text.language_id,
         'i18n_text': c.text.text
     }
     return htmlfill.render(self._edit_i18n_text_form(), defaults)