def get_namespace(self, resource, context): ws_languages = context.root.get_value('website_languages') # Active languages default = ws_languages[0] active = [] for code in ws_languages: language_name = get_language_name(code) active.append({ 'code': code, 'name': language_name, 'isdefault': code == default}) # Not active languages not_active = [ x for x in get_languages() if x['code'] not in ws_languages ] not_active.sort(lambda x, y: cmp(x['name'], y['name'])) # Ok return { 'active_languages': active, 'not_active_languages': not_active}
def get_namespace(self, resource, context): ws_languages = context.root.get_value('website_languages') # Active languages default = ws_languages[0] active = [] for code in ws_languages: language_name = get_language_name(code) active.append({ 'code': code, 'name': language_name, 'isdefault': code == default }) # Not active languages not_active = [ x for x in get_languages() if x['code'] not in ws_languages ] not_active.sort(lambda x, y: cmp(x['name'], y['name'])) # Ok return {'active_languages': active, 'not_active_languages': not_active}
def get_all_languages(self): """ Returns all ISO languages, used by 'manage_languages'. """ return i18n.get_languages() + self.get_user_defined_languages()
def get_all_languages(self): """ Returns all ISO languages, used by 'manage_languages'. """ return get_languages()