IntelliJ IDEA 2016.3 Help

Extracting Blocks of Text from Django Templates

This feature is supported in the Ultimate edition only.

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 /help/img/idea/2016.3/py_i18n_icon.png icon in the gutter.

To wrap block of text in translation tags

  1. Open the desired Django template for editing, and select strings to be marked for translation.
  2. Press Alt+Enter, or click the light bulb to reveal the list of available intention actions:
    /help/img/idea/2016.3/py_wrapTransTag.png
  3. Select intention action Wrap with 'trans' tag, and press Enter. IntelliJ IDEA wraps selected text in translation tags, and adds {% load i18n %}, if extracting text is performed for the first time.

See Also

Last modified: 21 March 2017