本文整理汇总了Python中config.Configuration.localization_languages方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.localization_languages方法的具体用法?Python Configuration.localization_languages怎么用?Python Configuration.localization_languages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config.Configuration
的用法示例。
在下文中一共展示了Configuration.localization_languages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Flask
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import localization_languages [as 别名]
from sqlalchemy.orm import sessionmaker
from config import Configuration
from core.model import SessionManager
from core.util import LanguageCodes
from flask.ext.babel import Babel
app = Flask(__name__)
testing = 'TESTING' in os.environ
db_url = Configuration.database_url(testing)
SessionManager.initialize(db_url)
session_factory = SessionManager.sessionmaker(db_url)
_db = flask_scoped_session(session_factory, app)
SessionManager.initialize_data(_db)
app.config['BABEL_DEFAULT_LOCALE'] = LanguageCodes.three_to_two[Configuration.localization_languages()[0]]
app.config['BABEL_TRANSLATION_DIRECTORIES'] = "../translations"
babel = Babel(app)
import routes
if Configuration.get(Configuration.INCLUDE_ADMIN_INTERFACE):
import admin.routes
debug = Configuration.logging_policy().get("level") == 'DEBUG'
logging.getLogger().info("Application debug mode==%r" % debug)
app.config['DEBUG'] = debug
app.debug = debug
def run():
debug = True
url = Configuration.integration_url(
示例2: get_locale
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import localization_languages [as 别名]
def get_locale():
languages = Configuration.localization_languages()
return request.accept_languages.best_match(languages)