def render(self, context): # Try to get request.LANGUAGE_CODE. If fail, use default one. if len(get_languages_keys()) > 1: ret_val = True else: ret_val = False if self.as_var: context[self.as_var] = ret_val return '' return ret_val
def render(self, context): # Try to get request.LANGUAGE_CODE. If fail, use default one. request = context['request'] language = get_language_from_request(request, default=None) if not language: language = smart_resolve(self.language, context) if not language in get_languages_keys(): language = default_language translation.activate(language) return ''