Commit c9f84af155b3e13bf87501da6e0aa2ff6ba22eb8
1 parent
c99d0e5f
Exists in
master
and in
3 other branches
starting language selector backend
Showing
4 changed files
with
27 additions
and
7 deletions
Show diff stats
amadeus/static/js/main.js
... | ... | @@ -25,4 +25,13 @@ $(function () { |
25 | 25 | $($(this).data('parent')).find('.panel-collapse.in').collapse('hide'); |
26 | 26 | $($(this).attr('href')).collapse('show'); |
27 | 27 | }); |
28 | -}); | |
29 | 28 | \ No newline at end of file |
29 | +}); | |
30 | + | |
31 | +var change_language = { | |
32 | + post: function(url, language){ | |
33 | + $.post(url, language ,function(data){ | |
34 | + console.log(data); | |
35 | + }); | |
36 | + } | |
37 | +} | |
38 | + | ... | ... |
amadeus/templates/base.html
... | ... | @@ -106,13 +106,13 @@ |
106 | 106 | </a> |
107 | 107 | <ul class="dropdown-menu"> |
108 | 108 | <li > |
109 | - <a href="#"> | |
109 | + <a href="#" class="language-item"> | |
110 | 110 | <img src="{% static "img/brazilicon.png" %}" /> |
111 | - <span>{% trans "PT-BR" %}</span> | |
111 | + <span>{% trans "pt_BR" %}</span> | |
112 | 112 | </a> |
113 | 113 | </li> |
114 | 114 | <li> |
115 | - <a href="#"> | |
115 | + <a href="#" class="language-item"> | |
116 | 116 | <img src="{% static "img/euaicon.png" %}" /> |
117 | 117 | <span>{% trans "EN" %}</span> |
118 | 118 | </a> |
... | ... | @@ -268,6 +268,16 @@ |
268 | 268 | <script type="text/javascript">$.material.init()</script> |
269 | 269 | <script src="{% static 'js/main.js' %}"></script> |
270 | 270 | <script src="{% static 'js/socket.js' %}"></script> |
271 | + | |
272 | + <!-- Language selector code --> | |
273 | + | |
274 | + <script> | |
275 | + $(".language-item").click(function(event) { | |
276 | + | |
277 | + change_language.post("{% url 'set_language' %}", ); | |
278 | + | |
279 | + }); | |
280 | + </script> | |
271 | 281 | </body> |
272 | 282 | |
273 | 283 | </html> |
274 | 284 | \ No newline at end of file | ... | ... |
amadeus/urls.py
... | ... | @@ -39,6 +39,7 @@ urlpatterns = [ |
39 | 39 | url(r'^pendencies/', include('notifications.urls', namespace = 'notifications')), |
40 | 40 | url(r'^links/', include('links.urls', namespace='links')), |
41 | 41 | url(r'^pdf_files/', include('pdf_file.urls', namespace='pdf_files')), |
42 | + url(r'^i18n/', include('django.conf.urls.i18n')), | |
42 | 43 | #API |
43 | 44 | url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), |
44 | 45 | #S3Direct | ... | ... |
users/templates/users/login.html
... | ... | @@ -85,13 +85,13 @@ |
85 | 85 | </a> |
86 | 86 | <ul class="dropdown-menu"> |
87 | 87 | <li class="active"> |
88 | - <a href="#"> | |
88 | + <a href="#" class="language-item" value="pt_BR"> | |
89 | 89 | <img src="{% static "img/brazilicon.png" %}" /> |
90 | - <span>{% trans "PT-BR" %}</span> | |
90 | + <span>{% trans "pt_BR" %}</span> | |
91 | 91 | </a> |
92 | 92 | </li> |
93 | 93 | <li > |
94 | - <a href="#"> | |
94 | + <a href="#" class="language-item" value="EN"> | |
95 | 95 | <img src="{% static "img/euaicon.png" %}" /> |
96 | 96 | <span>{% trans "EN" %}</span> |
97 | 97 | </a> | ... | ... |