diff --git a/CHANGES.rst b/CHANGES.rst index ed4d588c..7889a703 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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) diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py index 34906f11..3e191218 100644 --- a/plone/app/content/browser/vocabulary.py +++ b/plone/app/content/browser/vocabulary.py @@ -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 @@ -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: @@ -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: