GithubHelp home page GithubHelp logo

amandasaurus / django-template-i18n-lint Goto Github PK

View Code? Open in Web Editor NEW
69.0 2.0 36.0 71 KB

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

Home Page: http://www.technomancy.org/python/django-template-i18n-lint/

License: BSD 3-Clause "New" or "Revised" License

Python 96.19% Vim Script 3.81%

django-template-i18n-lint's Introduction

Django Template i18n lint

Build Status Coverage Status PyPI version PyPI Downloads

A simple script to find non-i18n text in a Django template.

It can also automatically wrap the strings in {% trans "" %} tags, by running it with the -r command-line flag. The translation will be written to a new file, <filename>_translated.html.

For more info see Lint tool to find non-i18n strings in a django template

Code is copyright Rory McCann 2013, 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

Bitdeli Badge

django-template-i18n-lint's People

Contributors

acdha avatar aherranz avatar bitdeli-chef avatar fmr avatar justhamade avatar lowks avatar maiksprenger avatar pegler avatar skorokithakis avatar yrik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

django-template-i18n-lint's Issues

Dual Licensing

Hello,

Is the dual licensing meant as 'AND' (you have to fulfill both BSD and GPLv3) or an 'OR' (you either have to fulfill BSD or GPLv3).

If the argument is the AND, the BSD license is not required as it is fully contained within the GPLv3 requirements.
If the argument is the OR, the GPLv3 license is not required as relicensing under GPLv3 can be done at any time by users.

Bug when running from command line

I feel like I'm missing something obvious... But it looks like one should pass overwrite into the replace_strings function.

(oscar)(releases/0.6) T530:templates $ ./django_template_i18n_lint.py -r
Traceback (most recent call last):
  File "./django_template_i18n_lint.py", line 188, in <module>
    main()
  File "./django_template_i18n_lint.py", line 183, in main
    replace_strings(filename)
  File "./django_template_i18n_lint.py", line 125, in replace_strings
    if options.overwrite:
NameError: global name 'options' is not defined

Memoization

It'd be great to have the script could use Memoization to keep track of the answers and doesn't ask the user twice for the same string. This could be made optional so the user can decide. I'd be happy to implement this.

Please provide licence details

Hi Rory

What licence is this code released under, please? I need to know before I can use it properly in a project.

Cheers
Steve

parsing issues

-  <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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.