def lang(self, lang): try: set_lang(lang) except LanguageError: return 'json:', dict(success=False) return 'json:', dict(success=True)
def translate(self, lingua=None): try: set_lang(lingua) except LanguageError: return _("Invalid language selection.") return _("I now speak %(lingua)s.") % dict(lingua=lingua)
def set_lang(self, l=None): set_lang(l) return gettext('This works!')