Personal tools
You are here: Home dk Work Documentation How-tos Deep Link Portal Tabs in Multiple Languages
Document Actions

Deep Link Portal Tabs in Multiple Languages


This How-to is intended for: designKiln

On the Marillac site we added the about_nav tabs to link into specific pages or folders inside the about us section. But we also needed the tabs and the location to translate into Spanish.

I found news items by Limi explaining how to create portal_tab links that work in different languages


action:     python:  
portal.products.getTranslation(portal.portal_languages.getPreferredLanguage()).absolute_url()
condition: python:
portal.products.getTranslation(portal.portal_languages.getPreferredLanguage())


This did not work for us as we were linking down 2 levels, through about-us to locations (for example).

What I finally chose to do, based on a limited number of tabs (currently 3) and a limited number of languages (currently 2) is to use the condition field in portal actions to select the language. Here are the portal_actions entries for the English and Spanish Volunteer/Voluntario links.


Title

Id

URL (Expression)

Condition (Expression)

Permission

Category
about_nav


Title

Id

URL (Expression)

Condition (Expression)

Permission

Category
about_nav



There is no translating necessary as the Title takes care of that. The URL (Expression) can link to the content specific to the language because the Condition (Expression) only permits the appropriate set of content to be displayed.

The condition is the same one we use in the simple_portlet_anon to find the correct right_column_tab for the language being requested. Any of the Spanish language browsers get Spanish, all other browsers get English.




Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: