i want translate part of js in django.
i've try command python manage.py makemessages -d djangojs take file in template_dirs in settings.py
i've try set js in template directory, , work perfectly.
i've djangojs.po , can generate .mo when compile.
so question : how make message in static file?
i've found same problem here , here no 1 answer keep architecture.
please, save me!
my architecture:
- myapp
- locale
- static
- myapp
- js
- try.js
- js
- myapp
- template
- myapp
- try.html
- myapp
- views.py
- urls.py
- [...]
ps: sorry english, i'm not native ;)
my error when set static_root in settings.py. in fact variable @ django stock static when collectstatic on server, used found static (django can find static whitout informations, find static on folder static on project folder or on app folder)
finally :
set in urls.py of pro
js_info_dict = { 'domain': 'djangojs', 'packages': ('app.kanboard',), } urlpatterns = patterns('', [...] #internationalization javascript url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), ) in template
<script type="text/javascript" src="{% url 'django.views.i18n.javascript_catalog' %}"></script> in js in static/my_app/my_file.js
document.write(gettext('ma chaine de caractère traduire')) after, rule command-line
python manage.py makemessages -d djangojs here, djangojs domain set in urls.py @ begin (it's pseudo-convention)
at time, have djangojs.po in folder locale can compile standard .po.
link of doc : here
lik of ticket can find sample project , explication in english : the ticket
good luck !
Comments
Post a Comment