amandasaurus / django-template-i18n-lint

Lint tool to find non-trans/blocktrans text in django templates
http://www.technomancy.org/python/django-template-i18n-lint/
BSD 3-Clause "New" or "Revised" License
69 stars 36 forks source link

parsing issues #17

Closed yrik closed 9 years ago

yrik commented 9 years ago
-  <input type="submit" value="Confirm" class="btn btn-danger" /> 
+  <input type="submit" {% trans "value=\"Confirm" %}" class="btn btn-danger" />  
-              <li><a href="https://twitter.com/localunews" class="icon-twitter" rel="tooltip" title="" data-placement="top" data-original-title="Twitter"><i class="fa fa-twitter"></i></a></li>

+              <li><a href="https://twitter.com/localunews" class="icon-twitter" rel="tooltip" {% trans "title" %}="" data-placement="top" {% trans "data-original-title=\"Twitter" %}"><i class="fa fa-twitter"></i></a></li>

And {% blocktrans %} is not used for multiline text.

amandasaurus commented 9 years ago

Thanks for the bug report. I've fixed that in master, and released v1.1.2 which fixes this.

Initially, I used this tool for interactive replacement, so I wanted to see the attribute that needed to be changed, hence why it wasn't caught by that regex. However with automatic replacement, the code needs to get a lot smarter. (which it now is).