def get_lang(): ''' Returns the current language. Based on babel.i18n.get_lang but works when set_lang has not been run (i.e. still in English). ''' if is_flask_request(): from ckan.config.middleware.flask_app import get_locale return get_locale() return 'en'
def get_lang(): ''' Returns the current language. Based on babel.i18n.get_lang but works when set_lang has not been run (i.e. still in English). ''' if is_flask_request(): from ckan.config.middleware.flask_app import get_locale return get_locale() else: langs = i18n.get_lang() if langs: return langs[0] return 'en'