Edit text in portlet headings, plone 4

I am trying to change the text displayed in the "Recent Changes" portlet to read "Most Recent."
I have found recent.pt in portal_view_customizations but the template has a variable instead of clear text where the heading goes:

 <tal:title content="obj/pretty_title_or_id">

I tried editing the variable but it returned an error. I edited the word "Title" but that didn't change anything.
How do I accomplish this?


(look in oppgaveportlet.py if you need to see where it is defined)

Thank you Espen.
Ideally, what I would like to do is find where the words "Recent Changes" exist that the portlet template is calling them from, and change those words to read "Most Recent." Is that possible to accomplish?
Thank you again, Espen.

Override the box_recent_changes id in your own translation file for plone namespace.
In the Recent Portelt is the key defined. In the plone.app.locales is the key with a empty value. The default from the script is taken. If you want to know how override the value look here

1 Like

@1letter 's suggestion is elegant.

But I think this is the line you could edit directly:

ie. change the line to something like

tal:content="string: Most Recent" />

yes, of course, its the easier solution, but not multilingal.

Solution via own Language Translation File in ie. my.addon, add/change the attribute i18n:domain :

<header class="portletHeader">
    <a href="#"
        tal:attributes="href view/recently_modified_link"
        i18n:translate="" >Recent Changes</a>
1 Like

Those of us who use English are indeed very lazy!

Another advantage of using the translation mechanism to change text is that it does not require customization of viewlets via portal_view_customizations, which can have bad side effects (ie. permission problems caused by customized views invoking Python methods that break because they're now being called using Restricted Python)

However, since you need to modify the translation file on the file system and that clients be restarted, it requires a level of access that not all website administrators may have... or is there a way to do it 'live' on a site with just the web browser?


Thanks for the pointers. I will probably just edit the tal content line and let that live that way for a while. It is at proof-of-concept and minimal viable product stage now so that is all that is required. Thank you again.

The reason for using TAL is to have the content 'dynamic', translatable or similar, so if you want to 'hard code' the content, skip TAL stuff.

In your case:

<a href="#"  tal:attributes="href view/recently_modified_link">
    My Text here

Whenever you see things like:

<h1 tal:content="some/thing">

The word 'Title' is 'basically a comment' (and can be used for theming)

<h1 tal:content="some/thing" />

Would produce the exact same output

or with Plone 5 / Chameleon


which i prefer

Personally, whenever the need comes up to customize a portlet, I try to find an alternative solution using the web-UI-possibilities, it's less of a hustle.

Here you could create a collection, showing all items sorted by modification-date, and then add a collection-portlet. That allows you to enter an arbitrary portlet-header-title via the UI.

For multilingual sections, add a portlet for each language. While this doesn't use a translation-machinery, it can also be an advantage to be able to change titles as wished by site-users. That depends on your specific requirements.

You can make this reproducible within an add-on, by creating the collection on a reinstall/upgradestep and assigning the portlet via a GenericSetup's profile (export portlets.xml of the site and include it in a profile).

1 Like