An Untranslated Items portlet for Plone
In conjunction with my recent experiments with I18N and Plone, I've also developed a helpful portlet for identifying "untranslated" documents. This script provides a simple guide for any translators in your content management workflow to identify new documents to translate. I'd prefer calling this portlet a recipe, not a complete product -- you'll likely have to modify it for your specific needs.
See Plone and Internationalization for the genesis of this project.
This script should be created as a Page Template in plone_skins/custom/portlet_untranslated. Then, in your Zope Management Interface's root properties, add
here/portlet_untranslated/macros/portlet to either your left_slot or right_slot.
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
i18n:domain="plone">
<body>
<!-- The news box -->
<div metal:define-macro="portlet"
tal:define="brains python:request.get('untranslated', here.portal_catalog.searchResults( sort_on='Date'
, sort_order='reverse'
, review_state='published'));
results python:[ brain.getObject() for brain in brains if brain.getObject() != None
and brain.getObject().portal_type in ['Event','News Item','Document']
and brain.getObject().getParentNode().portal_type != 'I18NLayer'];
langs here/portal_languages/getSupportedLanguages;
langcount python:len(langs);
layers python: [ brain.getObject().getParentNode() for brain in brains if brain.getObject() != None
and brain.getObject().getParentNode().portal_type == 'I18NLayer'];
incompletelayers python: [layer for layer in layers if len(layer.retrieveFilteredLanguages()) < langcount];
results python: (results + incompletelayers)[:10]
"
tal:condition="python:results">
<div class="portlet" id="portlet-untranslated" tal:condition="not:here/portal_membership/isAnonymousUser">
<h5 i18n:translate="box_untranslated">Untranslated docs</h5>
<div class="portletBody">
<tal:block tal:repeat="obj results">
<div tal:define="oddrow repeat/obj/odd"
tal:attributes="class python:test(oddrow, 'portletContent even', 'portletContent odd')">
<a href=""
tal:attributes="href python:obj.absolute_url()">
<tal:block replace="structure python:path('here/'+obj.getIcon())"/>
<span tal:replace="python:test(obj.Title(), obj.Title(), obj.getId())"> Title </span>
</a>
<div class="portletDetails"
tal:content="python:here.toPortalTime(obj.Date())">July 7, 08:11</div>
</div>
</tal:block>
</div>
</div>
</div>
</body>
</html>