diff --git a/templates/base.html b/templates/base.html
index 9110592..6037e92 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,5 +1,4 @@
-{% if 'jinja2.ext.i18n' not in JINJA_EXTENSIONS %}
- {% macro _(msg) %}
+{% if JINJA_ENVIRONMENT is defined and 'jinja2.ext.i18n' not in JINJA_ENVIRONMENT['extensions'] or JINJA_ENVIRONMENT is not defined and 'jinja2.ext.i18n' not in JINJA_EXTENSIONS %} {% macro _(msg) %}
{{ msg % kwargs }}
{% endmacro %}
{% endif %}