Skip to content

untrimmed-blocktranslate

Added in 0.2.8 · Related issues · View source

Fix is always available.

What it does

Checks for {% blocktranslate %} / {% blocktrans %} blocks that omit the trimmed option.

Why is this bad?

Without trimmed, indentation and whitespace inside the block become part of the translation string in .po files. Reformatting the template then reorders bytes inside translatable strings, producing noisy translation diffs on every reformat.

Example

{% blocktranslate %}This string will have {{ value }} inside.{% endblocktranslate %}

Use instead:

{% blocktranslate trimmed %}This string will have {{ value }} inside.{% endblocktranslate %}

Fix safety

This rule's fix is marked as safe: it inserts trimmed immediately after the tag name in the opening tag without altering the translatable content.

References