def register_babel(app):
 from flask_babel import Babel
 babel = Babel(app)
 supported = app.config.get('BABEL_SUPPORTED_LOCALES', ['en', 'zh'])
 default = app.config.get('BABEL_DEFAULT_LOCALE', 'en')
 @babel.localeselector
 def get_locale():
  return request.accept_languages.best_match(supported, default)

def register_babel ( app ) : from flask_babel import Babel babel = Babel ( app ) supported = app . config . get ( 'BABEL_SUPPORTED_LOCALES' , [ 'en' , 'zh' ] ) default = app . config . get ( 'BABEL_DEFAULT_LOCALE' , 'en' ) @ babel . localeselector def get_locale ( ) : return request . accept_languages . best_match ( supported , default )
configure babel for internationality .