Closed frague59 closed 8 months ago
Hey @frague59! If you have already refactored your code base to use the new names, you can use a .djlint_rules.yaml
file to create rules to find the outdated tags and trigger errors. Something like this:
- rule:
name: CR01
message: Deprecated template tag 'trans' found. Use 'translate' instead.
flags: re.DOTALL
patterns:
- \{% *trans +
- rule:
name: CR02
message: Deprecated template tag 'blocktrans' found. Use 'blocktranslate' instead.
flags: re.DOTALL
patterns:
- \{% *blocktrans +
- rule:
name: CR03
message: Deprecated template tag 'endblocktrans' found. Use 'endblocktranslate' instead.
flags: re.DOTALL
patterns:
- \{% *endblocktrans *%}
More details about custom rules: https://djlint.com/docs/linter/
Thanks for your answer, I'll put this into my projects.
Feature Request
From django docs, I can see the
trans
template tag has been renamed totranslate
from django 3.1.https://docs.djangoproject.com/en/3.2/topics/i18n/translation/#translate-template-tag
The
blocktrans
has been moved toblocktranslate
too.Is it possible djLint warn users about these namings ?
Thanks! ðŸ¤