def render(self, context): request = context['request'] text = self.text.resolve(context) try: return translate(text, to=request.session.get('lang','id')) except template.VariableDoesNotExist: return 'Variabel tidak ada'
def render(self, context): bf = self.text.resolve(context) request = context.get('request', None) if request is None: label = bf.label else: language = request.session.get('lang','id') label = translate(bf.label, to=language) req = _required(bf.field.required) label = '<label>%s:%s</label>' % (label, req) errors = bf.errors and '\n' + str(bf.errors) or '' return "\n" + '<div class="field-wrapper">' + \ "\n" + label + \ "\n" + bf.as_widget() + \ errors + \ "\n</div>"
def render(self, context): bf = self.text.resolve(context) request = context.get('request', None) if request is None: label = bf.label else: language = request.session.get('lang', 'id') label = translate(bf.label, to=language) req = _required(bf.field.required) label = '<label>%s:%s</label>' % (label, req) errors = bf.errors and '\n' + str(bf.errors) or '' return "\n" + '<div class="field-wrapper">' + \ "\n" + label + \ "\n" + bf.as_widget() + \ errors + \ "\n</div>"
def t_(text, request): return html2text(translate(text, to=request.session.get('lang','id')))
def t_(text, request=None): request = request or get_request() return html2text(translate(text, to=request.session.get('lang', 'id')))
def t_(text, request=None): request = request or get_request() return html2text(translate(text, to=request.session.get('lang','id')))