Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-3061

The tag bean:message always fetch Chinese resource even the user locale is set as English.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.1.0
    • 1.3.6
    • Tag Libraries
    • None
    • Windows 2000 server + JDK1.4.04
    • Patch, Important

    Description

      Set the language of IE as English. The locale of JVM is zh_CN.

      <bean:message key=...> will always fetch localized message from application_zh_CN.properties instead of application.properties.

      Please refer to the following script:
      ****************************************************************************
      <%@ page contentType="text/html; charset=utf-8" %>
      <%@ page language="java" session="true" %>
      <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
      <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
      <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
      <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
      <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
      <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

      <html:html locale="true">
      <c:set var="localeKey">
      <%=org.apache.struts.Globals.LOCALE_KEY %>
      </c:set>

      <fmt:setLocale value="${sessionScope[localeKey]}"/>
      <fmt:setBundle basename="ApplicationResources"/>

      fmt1=<fmt:message key="logged.in.txt"/></p>
      fmt2=<fmt:message key="app.logon.password.txt"/></p>
      bean1=<bean:message key="search.tabBanner.account.txt"/></p>
      ****************************************************************************

      The "fmt:messge" tag output English message, while "bean:message" output Chinese message.
      This problem can only be found when locale of JVM is set as "zh_CN" or "zh_TW ".

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              qiuhao qiuhao
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: