[opencms-dev] locale property - problem in 7.5.0 (7.0.5 also)

Christoph P. Kukulies kuku at physik.rwth-aachen.de
Tue Sep 8 15:53:09 CEST 2009


I must refine the center of the error a bit. See below between the
lines:


On Mon, Sep 07, 2009 at 04:04:48PM +0200, Christoph P. Kukulies wrote:
> I'm noticing that some pages no longer work when I'm trying to obtain
> the locale property:
> <%@page import="org.opencms.jsp.*,org.opencms.file.*,java.util.*" %>
> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> 
> 
> <c:set var="locale"><cms:property name="locale" file="search"/></c:set>
> <fmt:setLocale value="%{locale}"/>
> <fmt:bundle basename="messages">
> 
> <cms:template element="foot">
> <hr/>
> <% 
>    CmsJspActionElement cms = new CmsJspActionElement(pageContext,
> request, response);
>    String currentUri =cms.getRequestContext().getUri();
>    
>    String loc=cms.property("locale", "search");

The String loc ist detrmined correctly to contain the correct locale
property.

>    String path= currentUri.substring(0,currentUri.lastIndexOf('/'));
>   
> %>
> <div class="footbox"><div class="left">
> <%
>    if(loc.equals("de")) { %>
>     <a href="/de/about/Impressum.htm" ><fmt:message
> key="fussnote"/></a>
>                        <% } else { %>
>    <a href="/en/about/Impressum.htm"><fmt:message
> key="fussnote"/></a>

Only the wrong message is chosen. So the setLocale which is done in the
head template doesn't have any effect to the message bundle.

> 
> <% 
>    }
> %>
> 
> </div>
> <div class="right"><a class="right" href="#"><img
> src="<cms:link>/galleries/pics/pfeil.gif</cms:link>"
> alt="Beginn"/><fmt:message key="up"/></a>
> </div></div>
> </cms:template>
> 
> </fmt:bundle>
> 
> 
> Somehow the locale is not recognized. Always the en - version is shown
> although the page has the "de" locale.

Correction: The enlish message is chose from the bundle.

> 
> I changed (locale) to {locale} also to no avail.
> Before that I had changed 
> 
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
> 
> to 
> 
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
> 
> 
> --
Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de



More information about the opencms-dev mailing list