diff --git a/dpaste/locale/de/LC_MESSAGES/django.mo b/dpaste/locale/de/LC_MESSAGES/django.mo index 1a64a30..1f283bf 100644 Binary files a/dpaste/locale/de/LC_MESSAGES/django.mo and b/dpaste/locale/de/LC_MESSAGES/django.mo differ diff --git a/dpaste/locale/de/LC_MESSAGES/django.po b/dpaste/locale/de/LC_MESSAGES/django.po index 7dda8b3..d6ecd36 100644 --- a/dpaste/locale/de/LC_MESSAGES/django.po +++ b/dpaste/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: dpaste\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-10-25 10:06+0000\n" -"PO-Revision-Date: 2014-10-25 12:07+0100\n" +"PO-Revision-Date: 2014-10-28 11:20+0100\n" "Last-Translator: Martin Mahner \n" "Language-Team: DE \n" "Language: de\n" @@ -219,7 +219,7 @@ msgid "" "No snippets saved. Either all your snippets are expired or your cookie has " "changed." msgstr "" -"Keine Snippets gespeichert. Entweder alle deine Snippets sind erloschen oder " +"Keine Snippets gespeichert. Entweder sind alle deine Snippets erloschen oder " "dein Cookie hat sich geƤndert." #, fuzzy diff --git a/dpaste/locale/en/LC_MESSAGES/django.mo b/dpaste/locale/en/LC_MESSAGES/django.mo new file mode 100644 index 0000000..4f240ad Binary files /dev/null and b/dpaste/locale/en/LC_MESSAGES/django.mo differ diff --git a/dpaste/locale/es/LC_MESSAGES/django.mo b/dpaste/locale/es/LC_MESSAGES/django.mo new file mode 100644 index 0000000..ccbacb4 Binary files /dev/null and b/dpaste/locale/es/LC_MESSAGES/django.mo differ diff --git a/dpaste/locale/pt_BR/LC_MESSAGES/django.mo b/dpaste/locale/pt_BR/LC_MESSAGES/django.mo new file mode 100644 index 0000000..761fd64 Binary files /dev/null and b/dpaste/locale/pt_BR/LC_MESSAGES/django.mo differ diff --git a/dpaste/settings/__init__.py b/dpaste/settings/__init__.py index f02423a..3787708 100644 --- a/dpaste/settings/__init__.py +++ b/dpaste/settings/__init__.py @@ -1,6 +1,25 @@ # Import global settings to make it easier to extend settings. from django.conf.global_settings import * + +#============================================================================== +# Calculation of directories relative to the module location +#============================================================================== +import os +import sys +import dpaste + +PROJECT_DIR, PROJECT_MODULE_NAME = os.path.split( + os.path.dirname(os.path.realpath(dpaste.__file__)) +) + +# Set the variable root to $VIRTUALENV/var. +PYTHON_BIN = os.path.dirname(sys.executable) + +VAR_ROOT = os.path.join(os.path.dirname(PYTHON_BIN), 'var') +if not os.path.exists(VAR_ROOT): + os.mkdir(VAR_ROOT) + #============================================================================== # Generic Django project settings #============================================================================== @@ -30,32 +49,21 @@ SECRET_KEY = 'CHANGE_ME' # I18N #============================================================================== -USE_I18N = False +USE_I18N = True USE_L10N = False LANGUAGE_CODE = 'en' LANGUAGES = ( ('en', 'English'), + ('de', 'German'), + ('es', 'Spanish'), + ('pt-br', 'Portugese (Brasil)'), ) -#============================================================================== -# Calculation of directories relative to the module location -#============================================================================== -import os -import sys -import dpaste - -PROJECT_DIR, PROJECT_MODULE_NAME = os.path.split( - os.path.dirname(os.path.realpath(dpaste.__file__)) +LOCALE_PATHS = ( + os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'locale')), ) -# Set the variable root to $VIRTUALENV/var. -PYTHON_BIN = os.path.dirname(sys.executable) - -VAR_ROOT = os.path.join(os.path.dirname(PYTHON_BIN), 'var') -if not os.path.exists(VAR_ROOT): - os.mkdir(VAR_ROOT) - #============================================================================== # Static files #============================================================================== @@ -84,13 +92,15 @@ LOGIN_REDIRECT_URL = '/' MIDDLEWARE_CLASSES = ( 'django.middleware.csrf.CsrfViewMiddleware', - 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.locale.LocaleMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) TEMPLATE_CONTEXT_PROCESSORS += ( 'django.core.context_processors.request', + 'django.core.context_processors.i18n', ) INSTALLED_APPS = ( diff --git a/dpaste/templates/dpaste/about.html b/dpaste/templates/dpaste/about.html index afb2b37..b245d7b 100644 --- a/dpaste/templates/dpaste/about.html +++ b/dpaste/templates/dpaste/about.html @@ -17,6 +17,21 @@ github.com/bartTC/dpaste

+
+ {% csrf_token %} + Change the language: + + + +
+

API

dpaste provides a simple API documented in detail diff --git a/dpaste/urls/__init__.py b/dpaste/urls/__init__.py index 0a324a4..4ae40ff 100644 --- a/dpaste/urls/__init__.py +++ b/dpaste/urls/__init__.py @@ -4,6 +4,8 @@ urlpatterns = patterns( '', url(r'^', include('dpaste.urls.dpaste_api')), url(r'^', include('dpaste.urls.dpaste')), + + (r'^i18n/', include('django.conf.urls.i18n')), ) # Custom error handlers which load `dpaste/.html` instead of `.html`