コード例 #1
0
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'
コード例 #2
0
ファイル: i18n.py プロジェクト: CIOIL/DataGovIL
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'