title: How do I enable the 'trimmed' policy in Jinja2?
body: <p>I am trying to enable the trimmed keyword for all {% trans %} blocks in Jinja2. I have added <code>env.policies['ext.i18n.trimmed'] = True</code> (found here: <a href="https://jinja.palletsprojects.com/en/3.0.x/api/#policies" rel="nofollow noreferrer">https://jinja.palletsprojects.com/en/3.0.x/api/#policies</a>) in my environment configuration, but nothing happens. In my project I am using Babel with Jinja2 and Django to extract messages.</p>
  <p>Here is my environment configuration:</p>
  <pre><code>def environment(**options):
       env = Environment(
           **options,
           extensions=[
               'compressor.contrib.jinja2ext.CompressorExtension',
               'jinja2.ext.autoescape',
               'sass_processor.jinja2.ext.SassSrc',
               'jinja2.ext.i18n',
           ]
       }
  
       env.policies['ext.i18n.trimmed'] = True
       env.install_gettext_callables(gettext=gettext, ngettext=ngettext)
  
       env.globals.update(globals)
       env.filters.update(filters)
       return env
  </code></pre>