Skip to content

Instantly share code, notes, and snippets.

@wrwrwr
Created February 3, 2013 15:03
Show Gist options
  • Save wrwrwr/4702111 to your computer and use it in GitHub Desktop.
Save wrwrwr/4702111 to your computer and use it in GitHub Desktop.
diff --git a/settings.py b/settings.py
index b641b47..fc75500 100644
--- a/settings.py
+++ b/settings.py
@@ -168,7 +168,12 @@ USE_TZ = True
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = "en"
+gettext = lambda s: s
+LANGUAGES = (
+ ("de", gettext("German")),
+ ("en", gettext("English")),
+)
+LANGUAGE_CODE = LANGUAGES[0][0]
# A boolean that turns on/off debug mode. When set to ``True``, stack traces
# are displayed for error pages. Should always be set to ``False`` in
@@ -182,7 +187,7 @@ SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
-USE_I18N = False
+USE_I18N = True
# Make this unique, and don't share it with anybody.
SECRET_KEY = "22376b17-8b0d-4c47-bd63-68b94ff8be4ffb938952-678c-4b73-8d69-b2623127bd1d34f4d062-ab72-4848-88d4-2dbb76d64acd"
@@ -331,6 +336,7 @@ MIDDLEWARE_CLASSES = (
"mezzanine.core.middleware.UpdateCacheMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
+ "django.middleware.locale.LocaleMiddleware",
"django.contrib.redirects.middleware.RedirectFallbackMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
diff --git a/urls.py b/urls.py
index 080da42..166edd8 100644
--- a/urls.py
+++ b/urls.py
@@ -1,5 +1,6 @@
-from django.conf.urls.defaults import patterns, include, url
+from django.conf.urls.defaults import include, url
+from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from mezzanine.core.views import direct_to_template
@@ -11,7 +12,7 @@ admin.autodiscover()
# You can also change the ``home`` view to add your own functionality
# to the project's homepage.
-urlpatterns = patterns("",
+urlpatterns = i18n_patterns("",
# Change the admin prefix here to use an alternate URL for the
# admin interface, which would be marginally more secure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment