add languages option

This commit is contained in:
mandrag0ra 2014-05-23 17:44:03 +02:00
parent 064ec12be6
commit bd7c2b9277
2 changed files with 21 additions and 1 deletions

View File

@ -53,7 +53,7 @@ TIME_ZONE = 'Europe/Berlin'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
#LANGUAGE_CODE = 'en-us'
SITE_ID = 1
@ -110,6 +110,7 @@ TEMPLATE_LOADERS = (
)
MIDDLEWARE_CLASSES = (
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@ -373,3 +374,11 @@ MESSAGE_TAGS = {
constants.WARNING: 'alert-warning',
constants.ERROR: 'alert-danger',
}
#by default language is set to english - modify settings.py to set list of languages
#see https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files and
# https://docs.djangoproject.com/en/dev/topics/i18n/translation/#how-django-discovers-language-preference for details
gettext_noop = lambda s: s
LANGUAGES = (
('en', gettext_noop('English')),
)

View File

@ -28,3 +28,14 @@ DEBUG_TOOLBAR_PATCH_SETTINGS = False
INSTALLED_APPS += (
'debug_toolbar',
)
# For language translations
LANGUAGES = (
('fr', gettext_noop('French')),
"""
see https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files and
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#how-django-discovers-language-preference
for details
('de', _('German')),
"""
) + LANGUAGES