From ea27bf9e0fde68c98fa3dc31067ced94e2ab7d08 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Tue, 28 Oct 2014 11:22:43 +0100 Subject: [PATCH] Language support! --- dpaste/locale/de/LC_MESSAGES/django.mo | Bin 3559 -> 3559 bytes dpaste/locale/de/LC_MESSAGES/django.po | 4 +- dpaste/locale/en/LC_MESSAGES/django.mo | Bin 0 -> 378 bytes dpaste/locale/es/LC_MESSAGES/django.mo | Bin 0 -> 3600 bytes dpaste/locale/pt_BR/LC_MESSAGES/django.mo | Bin 0 -> 3549 bytes dpaste/settings/__init__.py | 46 +++++++++++++--------- dpaste/templates/dpaste/about.html | 15 +++++++ dpaste/urls/__init__.py | 2 + 8 files changed, 47 insertions(+), 20 deletions(-) create mode 100644 dpaste/locale/en/LC_MESSAGES/django.mo create mode 100644 dpaste/locale/es/LC_MESSAGES/django.mo create mode 100644 dpaste/locale/pt_BR/LC_MESSAGES/django.mo diff --git a/dpaste/locale/de/LC_MESSAGES/django.mo b/dpaste/locale/de/LC_MESSAGES/django.mo index 1a64a30824e4a75fb96bf46d750308132f8f3dbc..1f283bfaec42efe591bbfe9b1b5082cffb74ba8e 100644 GIT binary patch delta 50 zcmaDZ{akuODhIoTf}x?6k-_F1j&sZs#hH023W+&6sR}8nnR%%S!Fibl1*s*)n}c|! GG6DdxA`v|R delta 50 zcmaDZ{akuODhIo%f}xR>f%)bfj&sZsi8(o`3Mr|Xd8rD)d6@+TsU^h<#hH02n}c|! GG6DdyA`w6U 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 0000000000000000000000000000000000000000..4f240ad8a32d7be24cda7d5df9a0e67ea40495e1 GIT binary patch literal 378 zcmYL^u};G<6h(_*%E-*%fvvofR3HUYP)*~O2s^3Lv=VHlH6f_jk>eux5Ppwu;YC99 zN=F`io_*iX@zHk=bAX&6r^q34hIEOMF9A(v!Kw8bsl6})f>3mRV|d3l3<>fFmYOW9D+o7P028fE+7hFcuAs=hH*c{pa_Nj zsJqAiyhqLokU1ob+~-uL{ii(Rfl#f7(kat!mA8(P=~4)iG0Dk@OO}c;OOk>w7PqLH zYNsjFCn`JqLc<*(!UbF*l)^<~yijw%b_CfC#P2^@f literal 0 HcmV?d00001 diff --git a/dpaste/locale/es/LC_MESSAGES/django.mo b/dpaste/locale/es/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..ccbacb4f0beec12b94cfa76d809bd42d89566870 GIT binary patch literal 3600 zcmbW3O^h5z6~~Lj1Q73FLD;j~^aC5AwOMfg9j1_!xK_N8U%hj@CP7VAbtw6y}tmT2Y(Inc|HJPig*ad@cc=T_c;Udxi5gc z|0>A&@j7@3{0YeW{td(y;-4Vf#Sg*lRcyHXEGp+?U0|*t)N^6ri-F;qh{w_A_i*9! zzlh5AJ%!4C<}!mihstqd8`#dzp>l~(`5blO9Af*PM1293W6p8r(nRH)cz`=7eD1pN zS)M^Zr;>6yB(lR0;}C6`F%$??^_W2<{N>($kZ#LTSId93Cf$$=5eJyUwIJW|eN ziei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gxr% zF6x*zH8wXo(UMg-oynqQMZ93A`{&UOQRPNQ- zObRQL2p2AOZOZbp>5k7IrRwqcbVds_H*>Th_9YmShIIPs0{n%sUqgPqoxFy8Hr-NR z6Wk|Nl;<~O3hGVvVm&Y4F1(WwPe7tTr%K!Cd$?7_-Dk<+_6MWH~IxiuJGO6NGeIudBIAdilYr4x#79*UM zdsdfWGz+?^z7F9VkzMP}75p3ECzn~vC4c*&>MFfP%B%cFW>8n+s&m|tw{RpaQi6NW z+MVJ92_M&zK6y(l;a>|}psv*etd6XNo3K-`l-y+Ry40%@2g$|39I1=Y^vPvkBnDz0 WvI-wj?9+#i;9F9LdjDO>xX%FX^0&+Y literal 0 HcmV?d00001 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`