def init_app(self, app):
        """Flask application initialization.

        The initialization will:

         * Set default values for the configuration variables.
         * Load translations from paths specified in
           ``I18N_TRANSLATIONS_PATHS``.
         * Load translations from ``app.root_path>/translations`` if it exists.
         * Load translations from a specified entry point.
         * Add ``toutc`` and ``tousertimezone`` template filters.
         * Install a custom JSON encoder on app.
        """
        self.init_config(app)

        # Initialize Flask-BabelEx
        self.babel.init_app(app)
        self.babel.localeselector(self.localeselector or get_locale)
        self.babel.timezoneselector(self.timezoneselector or get_timezone)

        # 1. Paths listed in I18N_TRANSLATIONS_PATHS
        for p in app.config.get('I18N_TRANSLATIONS_PATHS', []):
            self.domain.add_path(p)
        # 2. <app.root_path>/translations
        app_translations = os.path.join(app.root_path, 'translations')
        if os.path.exists(app_translations):
            self.domain.add_path(app_translations)
        # 3. Entrypoints
        if self.entry_point_group:
            self.domain.add_entrypoint(self.entry_point_group)

        # Register default routes if URL is set.
        register_default_routes = app.config['I18N_SET_LANGUAGE_URL'] \
            and app.config['I18N_LANGUAGES']
        app.register_blueprint(
            create_blueprint(register_default_routes=register_default_routes),
            url_prefix=app.config['I18N_SET_LANGUAGE_URL']
        )

        # Register Jinja2 template filters for date formatting (Flask-Babel
        # already installs other filters).
        app.add_template_filter(filter_to_utc, name='toutc')
        app.add_template_filter(filter_to_user_timezone, name='tousertimezone')
        app.add_template_filter(filter_language_name, name='language_name')
        app.add_template_filter(
            filter_language_name_local, name='language_name_local')
        app.add_template_global(current_i18n, name='current_i18n')

        # Lazy string aware JSON encoder.
        app.json_encoder = get_lazystring_encoder(app)

        app.extensions['invenio-i18n'] = self
Flask application initialization.

        The initialization will:

         * Set default values for the configuration variables.
         * Load translations from paths specified in
           ``I18N_TRANSLATIONS_PATHS``.
         * Load translations from ``app.root_path>/translations`` if it exists.
         * Load translations from a specified entry point.
         * Add ``toutc`` and ``tousertimezone`` template filters.
         * Install a custom JSON encoder on app.