from flask import render_template from objects import glob @glob.app.context_processor def locale(): def _locale(lang, key): return glob.langs[lang][key] if key in glob.langs[lang] else key return dict(locale = _locale)