selectors for english, danish and spanish that allow you to change the text to the given language. To be able to uninstall the example app: .. code-block:: console $ ./app-teardown.sh """ from __future__ import absolute_import, print_function from flask import Flask, render_template from flask_babelex import lazy_gettext as _ from invenio_i18n import InvenioI18N # Create Flask application app = Flask(__name__) app.config.update( SECRET_KEY='CHANGE_ME', BABEL_DEFAULT_LOCALE='en', I18N_LANGUAGES=[('da', _('Danish')), ('es', _('Spanish'))], ) InvenioI18N(app) @app.route('/') def index(): return render_template('invenio_i18n/page.html')
def test_init_ext(app): """Test extension initalization.""" app.config["I18N_LANGUAGES"] = ["da"] i18n = InvenioI18N(entrypoint=None) i18n.init_app(app) assert i18n.babel
def app_i18n(app): """Init invenio-i18n.""" InvenioI18N(app) return app