Extract blocks of text from Django templates
IntelliJ IDEA provides a dedicated intention action to wrap strings in Django templates in {%trans
%}, or {%blocktrans
%} tags.
The lines with i18n tags are marked with icon in the gutter.
Wrap block of text in translation tags
Open the desired Django template for editing, and select strings to be marked for translation.
Press Alt+Enter, or click the light bulb to reveal the list of available intention actions:
Select intention action Wrap with 'trans' tag, and press Enter. IntelliJ IDEA wraps selected text in translation tags.
If extracting text is performed for the first time, {%
load i18n
%} will be added.
Last modified: 02 August 2022