[opencms-dev] How can I re-initialize the contents of a formatter into a specific language?

Patric Dosch patric.dosch at virtual-identity.com
Tue Aug 14 18:02:43 CEST 2012


Yes! Thanx... That was actually quite easy!


-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Georg Westenberger
Gesendet: Dienstag, 14. August 2012 17:20
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] How can I re-initialize the contents of a formatter into a specific language?

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              
        

_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev






More information about the opencms-dev mailing list