Skip to content

Instantly share code, notes, and snippets.

@wrwrwr
Created February 3, 2013 14:21
Show Gist options
  • Save wrwrwr/4701985 to your computer and use it in GitHub Desktop.
Save wrwrwr/4701985 to your computer and use it in GitHub Desktop.
diff --git a/settings.py b/settings.py
index ff815c7..c81adfd 100644
--- a/settings.py
+++ b/settings.py
@@ -105,7 +105,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 = (
+ ("en", gettext("English")),
+ ("de", gettext("German")),
+)
+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
@@ -119,7 +124,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 = "dd07fcc8-ca92-49b3-bba4-89d91670c2ed7e277804-ac62-4995-a9c4-d02da0567690967cb164-189b-4388-b602-78546cbc3c7f"
@@ -267,6 +272,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 8a798f8..cb34f16 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