santo
santo

Reputation: 63

JavaScript internationalization with django

I've got a script.js file which is located in common/static/js/ directory. Common is a directory, not an application and I need to translate messages inside script into other languages. How should I configure my django project? Basic instructions please, because I'm dumm.

Upvotes: 6

Views: 6384

Answers (1)

Brandon Taylor
Brandon Taylor

Reputation: 34553

A simple approach is to set your translatable values at the template level for your JavaScript functions/classes to pick up:

var my_name= '{% trans my_name %}';

But Django does have JavaScript internationalization.

Upvotes: 9

Related Questions