Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n support via django-hvad (nani) #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dependencies:
- django-hvad: https://github.com/KristianOellegaard/django-hvad
25 changes: 17 additions & 8 deletions portfolio/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.contrib import admin
from django.db import models
from django.contrib import admin
from nani.admin import TranslatableAdmin

from models import Service, Client, Proyect, Image, Country
from models import Service, Client, Project, Image, Country
from cms.plugins.text.widgets.wymeditor_widget import WYMEditor
from sorl.thumbnail.admin import AdminInlineImageMixin, AdminImageWidget
from django.conf.urls.defaults import patterns
Expand All @@ -17,23 +18,31 @@ def formfield_for_dbfield(self,db_field, **kwargs):
return super(ImageInline, self).formfield_for_dbfield(db_field, **kwargs)


class ProyectAdmin(admin.ModelAdmin):
class ProjectAdmin(TranslatableAdmin):
inlines = [ImageInline]
formfield_overrides = {
# models.TextField : {'widget': WYMEditor},
}
list_display = ("name", "sequence",)
list_editable = ( "sequence", )
#list_display = ("name", "sequence",)
#list_editable = ( "sequence", )
search_fields = ['name']
class Media:
js = (
"js/jquery-1.4.3.min.js",
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js",
"js/order.js")

class ServiceAdmin(TranslatableAdmin):
pass

admin.site.register(Service)
admin.site.register(Client)
admin.site.register(Country)
admin.site.register(Proyect,ProyectAdmin)
class ClientAdmin(TranslatableAdmin):
pass

class CountryAdmin(TranslatableAdmin):
pass

admin.site.register(Service, ServiceAdmin)
admin.site.register(Client, ClientAdmin)
admin.site.register(Country, CountryAdmin)
admin.site.register(Project, ProjectAdmin)

3 changes: 2 additions & 1 deletion portfolio/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ class PortfolioPluginBase(CMSPluginBase):
model = PortfolioPlugin
render_template = 'portfolio/portfolio.html'
name = _("Portafolio")

def render(self, context, instance, placeholder):
context.update({'instance':instance,'placeholder':placeholder})
context.update({'instance':instance, 'placeholder':placeholder})
return context

plugin_pool.register_plugin(PortfolioPluginBase)
Binary file added portfolio/locale/es/LC_MESSAGES/django.mo
Binary file not shown.
83 changes: 83 additions & 0 deletions portfolio/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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 <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-01-03 18:47+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

#: cms_app.py:6 cms_plugins.py:10
msgid "Portafolio"
msgstr ""

#: models.py:9 models.py:16 models.py:23 models.py:40
msgid "name"
msgstr "nombre"

#: models.py:29
msgid "service"
msgstr "servicio"

#: models.py:30
msgid "country"
msgstr "país"

#: models.py:31
msgid "client"
msgstr "cliente"

#: models.py:32
msgid "main image"
msgstr "imágen principal"

#: models.py:33
msgid "url"
msgstr "url"

#: models.py:34
msgid "slug"
msgstr "slug"

#: models.py:35
msgid "twitter"
msgstr "twitter"

#: models.py:36
msgid "facebook like"
msgstr "me gusta - facebook"

#: models.py:37 models.py:66
msgid "sequence"
msgstr "secuencia"

#: models.py:41
msgid "short description"
msgstr "descripción corta"

#: models.py:42
msgid "long description"
msgstr "descripción larga"

#: models.py:64
msgid "image"
msgstr "imágen"

#: models.py:65
msgid "main"
msgstr "principal"

#: models.py:67
msgid "project"
msgstr "proyecto"
164 changes: 0 additions & 164 deletions portfolio/migrations/0001_initial.py

This file was deleted.

Loading