Closed fmp-martins closed 12 years ago
I'm not sure how to i18n JavaScript. Have you done it before?
Yes.
You can do it using {% trans %} directly in you JavaScript (when the script is in your template), like:
{% block jsgallery %} <script type="text/javascript"> function startGallery() { var myGallery = new gallery($('myGallery'), { timed: {{has_extra_pictures}}, showArrows: {{has_extra_pictures}}, showCarousel: {{has_extra_pictures}}, textShowCarousel: '{% trans "Pictures" %}', showInfopane: false, embedLinks: false} ); } window.addEvent('domready', startGallery); </script> {% endblock %}
or you provide all the translations with you JavaScript script, like I explain in this jQuery date picker integration (last code example): http://blog.hexonio.com/2012/03/07/calendar-picker-django-forms/
How can I get in18n support? I'm developing a multilanguage website and the it always shows the GUI in english.