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

added translation functionality to folder content panel #71

Merged
merged 4 commits into from
Feb 18, 2016
Merged
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
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ New:

Fixes:

- *add item here*
- added translation functionality to folder content panel [terapyon]
https://github.com/plone/Products.CMFPlone/issues/1398


3.0.17 (2016-02-08)
Expand Down
16 changes: 15 additions & 1 deletion plone/app/content/browser/vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from zope.schema.interfaces import ICollection
from zope.schema.interfaces import IVocabularyFactory
from zope.security.interfaces import IPermission
from Products.CMFPlone import PloneMessageFactory as _
from zope.i18n import translate
from Products.CMFPlone.utils import safe_unicode
import inspect
import itertools

Expand Down Expand Up @@ -131,6 +134,14 @@ def __call__(self):
if isinstance(attributes, basestring) and attributes:
attributes = attributes.split(',')

translate_ignored = [
'Creator', 'Date', 'Description', 'Title', 'author_name',
'cmf_uid', 'commentators', 'created', 'effective', 'end',
'expires', 'getIcon', 'getId', 'getRemoteUrl', 'in_response_to',
'listCreators', 'location', 'modified', 'start', 'sync_uid',
'path', 'getURL', 'EffectiveDate', 'getObjSize', 'id',
'UID', 'ExpirationDate', 'ModificationDate', 'CreationDate',
]
if attributes:
base_path = getNavigationRoot(context)
for vocab_item in results:
Expand All @@ -153,7 +164,10 @@ def __call__(self):
continue
if key == 'path':
val = val[len(base_path):]
item[key] = val
if key not in translate_ignored and isinstance(val, basestring):
item[key] = translate(_(safe_unicode(val)), context=self.request)
else:
item[key] = val
items.append(item)
else:
for item in results:
Expand Down