From d317646f24aeaa028f3dd78c510b2ab1e8f53b82 Mon Sep 17 00:00:00 2001 From: Felipe Martin Date: Wed, 2 Apr 2014 17:07:57 +0200 Subject: [PATCH] + New fabric task: makemessages + Added Spanish language files + Activated locale: es --- .gitignore | 3 + config/local/requirements.txt | 3 + fabfile.py | 32 +++- shelfzilla/locale/es/LC_MESSAGES/django.mo | Bin 0 -> 1959 bytes shelfzilla/locale/es/LC_MESSAGES/django.po | 164 +++++++++++++++++++++ shelfzilla/settings/base.py | 13 +- shelfzilla/settings/local.py | 1 + shelfzilla/urls.py | 11 +- 8 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 shelfzilla/locale/es/LC_MESSAGES/django.mo create mode 100644 shelfzilla/locale/es/LC_MESSAGES/django.po diff --git a/.gitignore b/.gitignore index c37c9c2..c2c6a4e 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ static_components # Media shelfzilla/media/ + +# i18n +django.pot \ No newline at end of file diff --git a/config/local/requirements.txt b/config/local/requirements.txt index 3c8d7e7..d5cb636 100644 --- a/config/local/requirements.txt +++ b/config/local/requirements.txt @@ -1 +1,4 @@ -r ../requirements.txt + +# i18n +django-rosetta==0.7.4 \ No newline at end of file diff --git a/fabfile.py b/fabfile.py index 135a75c..3dc9d56 100644 --- a/fabfile.py +++ b/fabfile.py @@ -2,7 +2,7 @@ from __future__ import with_statement, print_function from os.path import dirname, abspath, join from fabric.api import * -from fabric.context_managers import settings +from fabric.context_managers import settings, cd from fabric.contrib.files import exists from fabric.colors import yellow, red, white, green @@ -76,7 +76,11 @@ def virtualenv(): """ Activates virtualenv first """ - return prefix('source .virtualenv/bin/activate') + return prefix( + 'source {}/.virtualenv/bin/activate'.format( + env.host_config['path'] + ) + ) # @@ -210,3 +214,27 @@ def rungrunt(): Executes grunt """ run('grunt --force') + + +@task_environment +@task +@hosts(['local']) +def makemessages(): + """ + Executes django-admin makemessages where needed + """ + with cd('shelfzilla'): + if not exists('locale'): + run('mkdir locale') + with virtualenv(): + run('django-admin.py makemessages -l es', quiet=True) + + """ + apps = ['homepage', 'landing', 'manga', 'users'] + for app in apps: + with cd('shelfzilla/apps/{}'.format(app)): + if not exists('locale'): + run('mkdir locale') + with virtualenv(): + run('django-admin.py makemessages -l es', quiet=True) + """ diff --git a/shelfzilla/locale/es/LC_MESSAGES/django.mo b/shelfzilla/locale/es/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..e4a269a7facf3870d4c61d171a0e15093094b745 GIT binary patch literal 1959 zcmZvcO>A355XTn?A2lkdfCLp^>k1?aJY%P=5;<|zBsgt^?OL%Dap1CkZ*6b%-mbg5 zFTsT#a^S*+3mo7U2_&u&2qcbJaNvLh2P6*kg2bg#B~Az=5dX2Co1|@I`?tF@v-_Xf zom_ux<|Br`Q}{lE@2mIFjIqUg5BMmC70e$3>tGJt%;o}o5c92!7JLBntKgI1ZpM$n z`!U}KkAq)>GvIe1`TqdYK0krSz+XW+=XdZC@Fqxp|AG`ZbKk`OSjH3JNvxj)@nL81 z^D;OGQd|e5{S`>@S3uIU4U*1x!94gO_%!$x_!RgvNax=GKR|8%0jVDEBbfAk0+RhR z@C5iJNauW?@kfx({{^Ide*+%}|IXHr!$|db0wljv_@VgI*}Mc&J?6oO!DW#2HZprR zV*=9sc#z_+fzN^Ofso8T1XZGtL>Hh|4!dL$IS@U`)>_Mrpj6CwhSf}uD^2Lh z2qW&&@pj!bj)#Tmx=H;J1Fa*fKIEZ^V;Op7G;4@NvPPP8q-9NOx+<2enRa3lgO%yX zvGuVggeHm9p0%V^(y>;Y_E>8mNIYw$Nh0i!wfo9(5r!t!o?{p(Cpxi=3T$J&#x|U^ zd`I~{k~dEB(8>rqDiJ%rBOKSp^DaW+zG>nV@+NSsFSaGy5!yTU&NVKg2+4bMD4RU3 z)7i0=A{ug|`Ou{Hb`L8PvyIrUHOV1cfufJtc90b+;mI%^%P3EU+Cu$;wJ6w>)}fAN z-dtLFW9ed*Z&ue^YnL0jbvZEB2X)s|QLvo$T+lXUo@-ui2P;rV#SdN=UY7Z6v2->l z;xo%jbLC>`mEvr%2*-d*PMhD|@7%<%CY%r2R%jOsZ)}-!zSzYzc%^&xLLv*evGci_ z(7hB-DQHWPlzDBbadCsxF4k%nVpTAX$D8r) z^cYcKSy)}sgOXu5KCNMrjzxQozDcBo7HQF6tQsj?6yE#62%WToX4hU=WjIoy{{R!k zS)+}1V9*GC_|W1D3{KU_7Lp^dV5<$kVOsGFdS{xhaI;<*&(A; z^VFr|)3Am}k}Ye^86 literal 0 HcmV?d00001 diff --git a/shelfzilla/locale/es/LC_MESSAGES/django.po b/shelfzilla/locale/es/LC_MESSAGES/django.po new file mode 100644 index 0000000..da28c03 --- /dev/null +++ b/shelfzilla/locale/es/LC_MESSAGES/django.po @@ -0,0 +1,164 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-02 17:01+0200\n" +"PO-Revision-Date: 2014-04-02 17:05+0200\n" +"Last-Translator: \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Translated-Using: django-rosetta 0.7.4\n" + +#: models.py:6 +msgid "For review" +msgstr "Para revisión" + +#: models.py:8 +msgid "Review comment" +msgstr "Comentario de revisión" + +#: apps/manga/admin.py:13 apps/manga/models.py:68 apps/manga/models.py:69 +#: themes/bootflat/templates/_layout.html:28 +#: themes/bootflat/templates/manga/publishers/detail.html:13 +#: themes/bootflat/templates/manga/series/list.html:4 +msgid "Series" +msgstr "Series" + +#: apps/manga/admin.py:24 apps/manga/models.py:88 +#: themes/bootflat/templates/manga/publishers/detail.html:16 +#: themes/bootflat/templates/manga/publishers/detail.html:36 +#: themes/bootflat/templates/manga/series/detail.html:23 +msgid "Volumes" +msgstr "Volúmenes" + +#: apps/manga/models.py:10 apps/manga/models.py:41 +#: themes/bootflat/templates/manga/publishers/detail.html:35 +msgid "Name" +msgstr "Nombre" + +#: apps/manga/models.py:11 apps/manga/models.py:42 +msgid "Slug" +msgstr "Álias" + +#: apps/manga/models.py:12 +msgid "URL" +msgstr "URL" + +#: apps/manga/models.py:36 +msgid "Publisher" +msgstr "Editorial" + +#: apps/manga/models.py:37 themes/bootflat/templates/_layout.html:31 +#: themes/bootflat/templates/manga/publishers/list.html:4 +#: themes/bootflat/templates/manga/series/detail.html:33 +msgid "Publishers" +msgstr "Editoriales" + +#: apps/manga/models.py:44 +msgid "Summary" +msgstr "Resumen" + +#: apps/manga/models.py:45 +#: themes/bootflat/templates/manga/publishers/detail.html:37 +#: themes/bootflat/templates/manga/series/detail.html:26 +msgid "Finished" +msgstr "Finalizado" + +#: apps/manga/models.py:73 +msgid "Number" +msgstr "Número" + +#: apps/manga/models.py:78 +msgid "ISBN-10" +msgstr "ISBN-10" + +#: apps/manga/models.py:80 +msgid "ISBN-13" +msgstr "ISBN-13" + +#: apps/manga/models.py:87 +#: themes/bootflat/templates/manga/series/includes/volume.html:24 +msgid "Volume" +msgstr "Volumen" + +#: apps/manga/models.py:99 +msgid "have" +msgstr "tiene" + +#: apps/manga/models.py:112 +msgid "wants" +msgstr "quiere" + +#: apps/manga/views/volumes.py:23 +msgid "{} is already on your collection!" +msgstr "¡{} ya está en tu colección!" + +#: apps/manga/views/volumes.py:32 +msgid "{} removed from wishlist" +msgstr "{} eliminado de la lista de deseados" + +#: apps/manga/views/volumes.py:38 +msgid "{} wishlisted!" +msgstr "¡{} añadido a la lista de deseados!" + +#: apps/manga/views/volumes.py:61 +msgid "{} removed from collection." +msgstr "{} eliminado de tu colección." + +#: apps/manga/views/volumes.py:66 +msgid "{} added to collection!" +msgstr "¡{} añadido a tu colección!" + +#: apps/users/forms.py:31 +msgid "This account is disabled." +msgstr "Esta cuenta está desactivada." + +#: apps/users/forms.py:35 +msgid "User with those credentials was not found." +msgstr "No se ha encontrado un usuario con esos credenciales." + +#: apps/users/views.py:39 +msgid "Logged in successfully." +msgstr "Has accedido correctamente." + +#: apps/users/views.py:58 +msgid "Logged out successfully" +msgstr "Sesión finalizada." + +#: settings/base.py:116 +msgid "Spanish" +msgstr "Español" + +#: themes/bootflat/templates/_layout.html:39 +msgid "My collection" +msgstr "Mi colección" + +#: themes/bootflat/templates/_layout.html:40 +msgid "Profile" +msgstr "Perfil" + +#: themes/bootflat/templates/_layout.html:46 +msgid "Log in" +msgstr "Entrar" + +#: themes/bootflat/templates/manga/publishers/detail.html:20 +msgid "Homepage" +msgstr "Página principal" + +#: themes/bootflat/templates/users/login.html:10 +msgid "Access the site" +msgstr "Accede al sitio" + +#: themes/bootflat/templates/users/login.html:23 +msgid "Login" +msgstr "Entrar" diff --git a/shelfzilla/settings/base.py b/shelfzilla/settings/base.py index 2d4b312..4191b03 100644 --- a/shelfzilla/settings/base.py +++ b/shelfzilla/settings/base.py @@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/1.6/ref/settings/ import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) +_ = lambda x: x + # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ @@ -78,6 +80,7 @@ MIDDLEWARE_CLASSES = ( 'reversion.middleware.RevisionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', + 'django.middleware.locale.LocaleMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', @@ -109,7 +112,15 @@ DATABASES = { # Internationalization # https://docs.djangoproject.com/en/1.6/topics/i18n/ -LANGUAGE_CODE = 'es-es' +LANGUAGES = ( + ('es', _('Spanish')), +) + +LANGUAGE_CODE = 'es' + +LOCALE_PATHS = ( + os.path.join(BASE_DIR, 'locale'), +) TIME_ZONE = 'Europe/Madrid' diff --git a/shelfzilla/settings/local.py b/shelfzilla/settings/local.py index 61bf5b1..3c5c00b 100644 --- a/shelfzilla/settings/local.py +++ b/shelfzilla/settings/local.py @@ -18,6 +18,7 @@ STATICFILES_DIRS += ( # Apps INSTALLED_APPS += ( 'django.contrib.webdesign', + 'rosetta', ) # Filer diff --git a/shelfzilla/urls.py b/shelfzilla/urls.py index 48b6d46..31a75c5 100644 --- a/shelfzilla/urls.py +++ b/shelfzilla/urls.py @@ -1,11 +1,12 @@ from django.conf.urls import patterns, include, url from django.conf import settings - from django.contrib import admin -admin.autodiscover() from .views import MessagesView + +admin.autodiscover() + urlpatterns = patterns( '', url(r'^messages/$', MessagesView.as_view(), name="contrib.messages"), @@ -27,3 +28,9 @@ if settings.DEBUG: {'document_root': settings.MEDIA_ROOT} ), ) + + if 'rosetta' in settings.INSTALLED_APPS: + urlpatterns += patterns( + '', + url(r'^rosetta/', include('rosetta.urls')), + )