diff options
-rw-r--r-- | example_project/settings.py | 7 | ||||
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 4 | ||||
-rw-r--r-- | ishtar_common/templates/base.html | 9 | ||||
-rw-r--r-- | ishtar_common/urls.py | 2 |
4 files changed, 22 insertions, 0 deletions
diff --git a/example_project/settings.py b/example_project/settings.py index 983339ee5..40aa25066 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -4,6 +4,8 @@ import os +from django.utils.translation import gettext_lazy as _ + DEBUG = False DEBUG_TOOLBAR = False TEMPLATE_DEBUG = DEBUG @@ -52,6 +54,11 @@ USE_I18N = True # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale USE_L10N = True +LANGUAGES = ( + ('fr', _('Français')), + ('en', _('Anglais')), +) +DEFAULT_LANGUAGE = 1 # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index 08e500425..72da8fdda 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -41,6 +41,9 @@ $(document).ready(function(){ $('#to_bottom_arrow').hide(); $('#to_top_arrow').hide(); } + $('#language_selector').change(function(){ + $('#language_form').submit(); + }); }); $('#to_bottom_arrow').live('click', function(){ @@ -51,6 +54,7 @@ $('#to_top_arrow').live('click', function(){ $("html, body").animate({ scrollTop: 0}, 1000); }); + $("#main_menu ul li").live('click', function(){ var current_id = $(this).attr('id'); console.log(current_id); diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index 2f197a841..0d0df59e5 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -30,6 +30,15 @@ <strong><a href="{% url auth_login %}">{% trans "Log in" %}</a></strong> {% endif %} {% endblock %} + {% comment %} + <form action="/i18n/setlang/" method="post" id='language_form'> + {% csrf_token %} + <select name="language" id='language_selector'> + {% for lang in LANGUAGES %} + <option value="{{ lang.0 }}">{{ lang.1 }}</option> + {% endfor %} + </select> + </form>{% endcomment %} </div> <div class="nav-button ui-state-default ui-corner-all" id="to_bottom_arrow"> <span class="ui-icon ui-icon-circle-arrow-s"></span> diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index a11c989d5..3a69ca002 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -28,6 +28,8 @@ urlpatterns, actions = [], [] # forms urlpatterns = patterns('', + # internationalization + url(r'^i18n/', include('django.conf.urls.i18n')), # General url(r'person_creation/(?P<step>.+)?$', views.person_creation_wizard, name='person_creation'), |