Issue Details (XML | Word | Printable)

Key: APF-266
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matt Raible
Reporter: king huang
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
AppFuse

the href(Appfuse in English) can't switch Locale to en while logining by the default welcome page

Created: 06/Feb/06 11:59 AM   Updated: 03/Oct/06 12:01 PM   Resolved: 03/Oct/06 12:01 PM
Return to search
Component/s: i18n
Affects Version/s: 1.9
Fix Version/s: 1.9.2

Environment:
Simplified Chinese windows XP sp2 IE6.0
Simplified Chinese windows 2000 sp4 IE6.0


 Description  « Hide
according to [APF-250],I put the localeFilter<filter-mapping> behing the encodingFilter<filter-mapping>,so,it is that the localeFilter<filter-mapping> behing securityFilter<filter-mapping> too, When I began to login by the default welcome page.(for example,liking http://127.0.0.1/myapp/login.jsp), I click the "Appfuse in English" ,Because I Operating System and IE default is Chinese,it should switch Locale to en.but now after clicking the href(Appfuse in English) it did nothing switching.maybe at that time value of "request.getParameter("locale")" is null in the LocaleFilter class.

Thanks.
anther.

Sort Order: Ascending order - Click to sort in descending order
king huang added a comment - 06/Feb/06 12:44 PM
another,I had login by Locale(zh),after clicking the href(Appfuse in English).
in the mainMemu.jsp:
<a href="<c:url value="/selectFile.html"/>"><fmt:message key="menu.selectFile"/></a>
[menu.selectFile]----value could switch to english.

<h:commandLink value="#{text['menu.user']}" action="#{userForm.edit}"/>
"#{text['menu.user']}" ---- value couldn't switch to english,it still was Chinese character.


Scott Hong added a comment - 10/Feb/06 11:06 AM
The encodingFilter should be placed in front of the localeFilter.

    <filter-mapping>
        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>localeFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

After these changes, make sure to clean up the original database and test the new
setup using new records. My works for me and it should also work on this case as
well.

king huang added a comment - 11/Feb/06 02:58 AM
thanks,Scott.
      now,the Filter 's sequence is securityFilter-->encodingFilter-->localeFilter.
when I opened the default login page(for example,liking http://127.0.0.1/myapp/login.jsp), clicking "Appfuse in English"(<a href="<c:url value='/mainMenu.html?locale=en'/>").because I hadn't login and securityFilter in front of the localeFilter,so the securityFilter redirect the page to ".../login.jsp",value of "request.getParameter("locale")" is null in the LocaleFilter class. so the default login page couldn't switch to english.
of course,it also can be resolved following :
*****If I set the Filter 's sequence is encodingFilter-->localeFilter-->securityFilter,above issue can be resolved,but i don't whether the new issue will occur or not .

*****the other ways,
<%c:if test="${pageContext.request.locale.language != 'en'}">
    <div id="switchLocale"><a href="<c:url value='/mainMenu.html?locale=en'/>"><fmt:message key="webapp.name"/> in English</a></div>
</c:if%>
change to following
<c:if test="${pageContext.request.locale.language != 'en'}">
    <div id="switchLocale">
    <a href="<c:url value= '${pageContext.request.requestURL}?locale=en' />">
    <fmt:message key="webapp.name"/> in English</a></div>
</c:if>

king huang added a comment - 11/Feb/06 03:11 AM
if I had login by Locale(zh),in the mainMemu.jsp:
<a href="<c:url value="/selectFile.html"/>"><fmt:message key="menu.selectFile"/></a>
<h:commandLink value="#{text['menu.user']}" action="#{userForm.edit}"/>
"[menu.selectFile]" ----value was "上传文件"
"#{text['menu.user']}" ----value was "编辑信息".

after clicking the href(Appfuse in English)
"[menu.selectFile]" ----value was "Upload A File "
"#{text['menu.user']}" ----value still was "编辑信息",the value should be " Edit Profile" .
maybe <f:loadBundle var="text" basename="#{basePage.bundleName}"/> can't switch .

Matt Raible added a comment - 12/Jun/06 09:29 PM
The first issue should be fixed. In 1.9.2, you should be able to switch locales without logging in.