Extract blocks of text from Django templates
Available only in PyCharm Professional: download to try or compare editions
This functionality relies on the Django plugin, which is bundled and enabled in PyCharm by default. If the relevant features are not available, make sure that you did not disable the plugin.
Press CtrlAlt0S to open settings and then select Plugins.
Open the Installed tab, find the Django plugin, and select the checkbox next to the plugin name.
PyCharm 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.
Open the desired Django template for editing, and select strings to be marked for translation.
Press AltEnter, or click the light bulb to reveal the list of available intention actions:
Select intention action Wrap with 'trans' tag, and press Enter. PyCharm wraps selected text in translation tags.
If extracting text is performed for the first time, {%
load i18n
%} will be added.
Thanks for your feedback!