Skip to content

Commit

Permalink
Merge pull request #7 from lepri/master
Browse files Browse the repository at this point in the history
Package localization enhanced
  • Loading branch information
avoinea committed Jun 3, 2013
2 parents 8bcbbd0 + fa9e1cf commit 8f5931d
Show file tree
Hide file tree
Showing 44 changed files with 3,905 additions and 234 deletions.
1 change: 1 addition & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changelog

7.5-dev - (unreleased)
----------------------
* Feature: Package localization enhanced [lepri]

7.4 - (2013-05-20)
------------------
Expand Down
22 changes: 12 additions & 10 deletions eea/app/visualization/browser/app/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from eea.app.visualization.events import VisualizationFacetDeletedEvent
from eea.app.visualization.zopera import IStatusMessage
from eea.app.visualization.interfaces import IDavizSettings
from eea.app.visualization.config import EEAMessageFactory as _

logger = logging.getLogger('eea.app.visualization')

DAVIZ_WARNING_WRONG_DATASET = """Data is missing, or is not well formated."""
Expand Down Expand Up @@ -150,15 +152,15 @@ def handle_facets(self, **kwargs):

if not order:
return self._redirect(
'Exhibit facets settings not saved: Nothing to do', ajax)
_('Exhibit facets settings not saved: Nothing to do'), ajax)

if not isinstance(order, list):
return self._redirect(
'Exhibit facets settings not saved: Nothing to do', ajax)
_('Exhibit facets settings not saved: Nothing to do'), ajax)

if len(order) == 1:
return self._redirect(
'Exhibit facets settings not saved: Nothing to do', ajax)
_('Exhibit facets settings not saved: Nothing to do'), ajax)

facets = mutator.facets
facets = dict((facet.get('name'), dict(facet)) for facet in facets)
Expand All @@ -171,7 +173,7 @@ def handle_facets(self, **kwargs):
continue
mutator.add_facet(**properties)

return self._redirect('Exhibit facets settings saved', ajax)
return self._redirect(_('Exhibit facets settings saved'), ajax)

def handle_facetDelete(self, **kwargs):
""" Delete facet
Expand All @@ -188,7 +190,7 @@ def handle_facetDelete(self, **kwargs):
event.notify(VisualizationFacetDeletedEvent(
self.context, facet=name))

return self._redirect('Exhibit facet deleted', ajax)
return self._redirect(_('Exhibit facet deleted'), ajax)

def handle_viewEnable(self, **kwargs):
""" Enable view
Expand All @@ -201,7 +203,7 @@ def handle_viewEnable(self, **kwargs):
except Exception, err:
logger.exception(err)
return self._redirect(err, ajax)
return self._redirect('View enabled', ajax)
return self._redirect(_('View enabled'), ajax)

def handle_views(self, **kwargs):
""" Sort views
Expand All @@ -212,15 +214,15 @@ def handle_views(self, **kwargs):

if not order:
return self._redirect(
'Views settings not saved: Nothing to do', ajax)
_('Views settings not saved: Nothing to do'), ajax)

if not isinstance(order, list):
return self._redirect(
'Views order not saved: Nothing to do', ajax)
_('Views order not saved: Nothing to do'), ajax)

if len(order) == 1:
return self._redirect(
'Views order not saved: Nothing to do', ajax)
_('Views order not saved: Nothing to do'), ajax)

views = mutator.views
views = dict((view.get('name'), dict(view)) for view in views)
Expand All @@ -232,7 +234,7 @@ def handle_views(self, **kwargs):
continue
mutator.add_view(**properties)

return self._redirect('Views order changed', ajax)
return self._redirect(_('Views order changed'), ajax)



Expand Down
34 changes: 18 additions & 16 deletions eea/app/visualization/browser/res/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,36 @@
from zope import schema
from zope.interface import Interface

from eea.app.visualization.config import EEAMessageFactory as _

class IVisualizationViewResources(Interface):
""" CSS/JS to be included by daviz-view.html
"""
extcss = schema.List(
title=u'External or required stylesheets',
description=(u'List of CSS resources to be included in view mode '
title=_(u'External or required stylesheets'),
description=_(u'List of CSS resources to be included in view mode '
'before CSS reources provided by css attribute'),
value_type=schema.TextLine(title=u'ExtCSS'),
readonly=True
)

css = schema.List(
title=u'Stylesheets',
description=u'List of CSS resources to be included by daviz-view.html',
title=_(u'Stylesheets'),
description=_(u'List of CSS resources to be included by daviz-view.html'),
value_type=schema.TextLine(title=u'CSS'),
readonly=True
)

extjs = schema.List(
title=u'External or required javascripts',
description=(u'List of JS resources to be included in view mode '
title=_(u'External or required javascripts'),
description=_(u'List of JS resources to be included in view mode '
'before JS reources provided by js attribute'),
value_type=schema.TextLine(title=u'ExtJS'),
readonly=True
)
js = schema.List(
title=u'Javascripts',
description=u'List of JS resources to be included by daviz-view.html',
title=_(u'Javascripts'),
description=_(u'List of JS resources to be included by daviz-view.html'),
value_type=schema.TextLine(title=u'JS'),
readonly=True
)
Expand All @@ -39,29 +41,29 @@ class IVisualizationEditResources(Interface):
""" CSS/JS to be included by daviz-edit.html
"""
extcss = schema.List(
title=u'External or required stylesheets',
description=(u'List of CSS resources to be included in edit mode '
title=_(u'External or required stylesheets'),
description=_(u'List of CSS resources to be included in edit mode '
'before CSS reources provided by css attribute'),
value_type=schema.TextLine(title=u'ExtCSS'),
readonly=True
)

css = schema.List(
title=u'Stylesheets',
description=u'List of CSS resources to be included by daviz-view.html',
title=_(u'Stylesheets'),
description=_(u'List of CSS resources to be included by daviz-view.html'),
value_type=schema.TextLine(title=u'CSS'),
readonly=True
)
extjs = schema.List(
title=u'External or required javascripts',
description=(u'List of JS resources to be included in edit mode '
title=_(u'External or required javascripts'),
description=_(u'List of JS resources to be included in edit mode '
'before JS reources provided by js attribute'),
value_type=schema.TextLine(title=u'EXTJS'),
readonly=True
)
js = schema.List(
title=u'Javascripts',
description=u'List of JS resources to be included by daviz-view.html',
title=_(u'Javascripts'),
description=_(u'List of JS resources to be included by daviz-view.html'),
value_type=schema.TextLine(title=u'JS'),
readonly=True
)
Expand Down
2 changes: 1 addition & 1 deletion eea/app/visualization/controlpanel/controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ForbiddenVisualizations(object):
"""
implements(IDavizSection)
prefix = 'forbidden'
title = 'Enable / Disable'
title = _('Enable / Disable')

def __init__(self):
voc = queryUtility(IVocabularyFactory,
Expand Down
4 changes: 2 additions & 2 deletions eea/app/visualization/facets/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def render(self):
if self._finished_add:
ajax = (self.request.form.get(self._action, '') == 'ajax')
if ajax:
return 'Facet added'
return _('Facet added')
self.request.response.redirect(self.nextURL())
return ""

Expand All @@ -97,6 +97,6 @@ def nextURL(self):
"""
status = queryAdapter(self.request, IStatusMessage)
if status:
status.addStatusMessage('Facet added', type='info')
status.addStatusMessage(_('Facet added'), type='info')
nexturl = self.context.absolute_url() + '/daviz-edit.html'
self.request.response.redirect(nexturl)
4 changes: 2 additions & 2 deletions eea/app/visualization/facets/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def save(self, action, data):
name = action.__name__.encode('utf-8')
value = self.request.form.get(name, '')
if value == 'ajax':
return 'Changes saved'
return _('Changes saved')
return self.nextUrl

@property
Expand All @@ -87,7 +87,7 @@ def nextUrl(self):
"""
status = queryAdapter(self.request, IStatusMessage)
if status:
status.addStatusMessage('Changes saved', type='info')
status.addStatusMessage(_('Changes saved'), type='info')
to = self.context.absolute_url() + '/daviz-edit.html'
self.request.response.redirect(to)

Expand Down
Loading

0 comments on commit 8f5931d

Please sign in to comment.