[opencms-dev] How can I re-initialize the contents of a formatter into a specific language?
Georg Westenberger
g.westenberger at alkacon.com
Tue Aug 14 17:20:05 CEST 2012
Hello Patric,
This is actually supported by the formatter tag. Unfortunately, we
forgot to configure it in the TLD file, but you can easily do so:
- Open the WEB-INF/opencms.tld file in your OpenCms installation
- Find the entry for the formatter tag, which looks like this:
<tag>
<description>
This tag loads single XML content items for ADE formatters.
</description>
<name>formatter</name>
<tag-class>org.opencms.jsp.CmsJspTagFormatter</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>var</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>val</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
- Add a new "locale" attribute to this entry as follows:
<tag>
<description>
This tag loads single XML content items for ADE formatters.
</description>
<name>formatter</name>
<tag-class>org.opencms.jsp.CmsJspTagFormatter</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>var</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>val</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<!-- Add this new attribute! -->
<name>locale</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
- Restart your servlet container.
- Now you can use this attribute in your formatter as follows:
<cms:formatter var="content" val="value">
<c:if test="${empty content.localeNames[cms.locale]}">
<cms:formatter var="content" val="value" locale="en" />
</c:if>
Kind Regards,
Georg.
--
Visit OpenCms Days 2012 Conference and Expo September 24 to 25, 2012 in Cologne, Germany http://www.opencms-days.org
Georg Westenberger
Alkacon Software GmbH - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org
More information about the opencms-dev
mailing list