# HG changeset patch # User ymh # Date 1339426022 -7200 # Node ID 01faf930abc547f92e2e7e1538bae78d44f68d48 # Parent b4b226944789aab5c07ccb3e476d03edae6d0e95 force the use of settings.LANGUAGE_CODE + desactivate localisation as it is not used diff -r b4b226944789 -r 01faf930abc5 web/tralalere/settings.py --- a/web/tralalere/settings.py Mon Jun 11 13:26:29 2012 +0200 +++ b/web/tralalere/settings.py Mon Jun 11 16:47:02 2012 +0200 @@ -32,7 +32,7 @@ # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'fr-fr' +LANGUAGE_CODE = 'fr-FR' ugettext = lambda s:s @@ -49,7 +49,7 @@ # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale. -USE_L10N = True +USE_L10N = False # If you set this to False, Django will not use timezone-aware datetimes. USE_TZ = True @@ -106,7 +106,7 @@ ) MIDDLEWARE_CLASSES = ( - 'django.middleware.gzip.GZipMiddleware', + 'tralalere.utils.ForceDefaultLanguageMiddleware', 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', diff -r b4b226944789 -r 01faf930abc5 web/tralalere/templates/home.html --- a/web/tralalere/templates/home.html Mon Jun 11 13:26:29 2012 +0200 +++ b/web/tralalere/templates/home.html Mon Jun 11 16:47:02 2012 +0200 @@ -2,6 +2,7 @@ {% block main_content %} {% load thumbnail %} {% load i18n %} +{% load l10n %}

Musitag

{% trans "Mets tes couleurs, tes émotions
et ta voix sur la musique !" %}

@@ -10,7 +11,7 @@ {% for content in contents %}
- {% thumbnail content.image "135x120" format="PNG" crop="center" as im %}{% endthumbnail %} + {% thumbnail content.image "135x120" format="PNG" crop="center" as im %}{% endthumbnail %}

{{content.title}} @@ -26,7 +27,7 @@ {% if tag.scale == 1 %}
{% else %} -
+
{% endif %}
@@ -42,7 +43,7 @@ {% if tag.scale == 1 %}
{% else %} -
+
{% endif %}
diff -r b4b226944789 -r 01faf930abc5 web/tralalere/utils.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/tralalere/utils.py Mon Jun 11 16:47:02 2012 +0200 @@ -0,0 +1,13 @@ +class ForceDefaultLanguageMiddleware(object): + """ + Ignore Accept-Language HTTP headers + + This will force the I18N machinery to always choose settings.LANGUAGE_CODE + as the default initial language, unless another one is set via sessions or cookies + + Should be installed *before* any middleware that checks request.META['HTTP_ACCEPT_LANGUAGE'], + namely django.middleware.locale.LocaleMiddleware + """ + def process_request(self, request): + if request.META.has_key('HTTP_ACCEPT_LANGUAGE'): + del request.META['HTTP_ACCEPT_LANGUAGE']