django-angular-template-i18n-lint

Lint tool to find non-trans/blocktrans/|translate text in django/angular templates


License
GPL-3.0+
Install
pip install django-angular-template-i18n-lint==0.1

Documentation

Django Angular Template i18n lint

Bitdeli Badge Build Status Coverage Status

Fork of original project by Rory McCann, https://github.com/rory/django-template-i18n-lint, description by original author: Lint tool to find non-i18n strings in a django template

A simple script to find non-i18n text in a Django and angular templates, including:

  • native Django translation {% trans 'x' %} and {% blocktrans %}

  • angular translations using {[{ 'xx'|translate }]} and <p translate>paragraph</p>

  • supports a lot of custom angular directives, especially used by ArabellaTech (name starts with aa-)

Usage:

$ python django_angular_template_i18n_lint.py templates > not_translated.txt

saves all untranslated strings into given file. The original option to wrap in translation blocks was removed, due to support of many translation options (i.e. angular).

Program docs are available:

$ python django_angular_template_i18n_lint --h

Usefull hints:

Putting {# notrans #} or <!-- notrans --> at the begining of line will prevent that line from showin in the results.

Known issues

  • <div translate><span></span><i class='x'></i>SomeText</div> will fail due to html tags inside. Required is to use <span translate>value</span> or {[{ 'x'|translate}]}

  • in some situations it will be preferable to use {[{ 'x'|translate}]} instead of <tag translate>, in example when tag has data- or aa- or ng- attribute

Code is copyright Rory McCann 2013 and ArabellaTech 2015, and dual licenced under the GNU GPL version3 (or at your option a later version), and the BSD licence. See the files LICENCE.GPLv3 and LICENCE.BSD for more information