Results 1 to 7 of 7
  1. #1
    mikmontana is offline Member
    Join Date
    Oct 2011
    Posts
    7
    Rep Power
    0

    Default change locale not working - please help me

    Hi all,

    I'm trying to develop a multilanguage web application, I found the instruction to change the language at this link
    Chapter*13.*Web MVC framework
    and I have only add this code on my dispatcher-servlet :


    Java Code:
    <bean id="localeChangeInterceptor"
              class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName" value="siteLanguage"/>
        </bean>
    
        <bean id="localeResolver"
              class="org.springframework.web.servlet.i18n.CookieLocaleResolver"/>
    
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="interceptors">
                <list>
                    <ref bean="localeChangeInterceptor"/>
                </list>
            </property>
            <property name="mappings">
                <props>
                    <prop key="login.htm">indexController</prop>
    		<prop key="uploadfile.htm">fileUploadController</prop>
                    <prop key="successUpload.htm">successUploadController</prop>
                </props>
            </property>
        </bean>
    and I try to change the language with this link : index.htm?siteLanguage=en_EN
    but is not working.

    Please help me....

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,864
    Rep Power
    8

    Default Re: change locale not working - please help me

    What does "it's not working" mean? What do you expect to happen? What happens instead?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    mikmontana is offline Member
    Join Date
    Oct 2011
    Posts
    7
    Rep Power
    0

    Default Re: change locale not working - please help me

    With the link index.htm?siteLanguage=en_EN i want to change the language of the page, but nothing happen when i load this url.

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,864
    Rep Power
    8

    Default Re: change locale not working - please help me

    Um, I don't think there's a way to just change the language like that. Locale != language. Changing the language there does not magically change the text on the page, it just changes what language the browser thinks is being displayed, which doesn't really do much for you.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    mikmontana is offline Member
    Join Date
    Oct 2011
    Posts
    7
    Rep Power
    0

    Default Re: change locale not working - please help me

    I have a file properties with the label that I want to change the language, one properties for each language.
    If I modify the language of the browser, it also change the language of my page, but I want to change language with a link on the page or somethings like this.




    PS: I'm sorry for my poor English...

  6. #6
    jacobblack is offline Member
    Join Date
    Dec 2011
    Posts
    5
    Rep Power
    0

    Default Re: change locale not working - please help me

    I have the same problem.
    The servlet xml succeed to load the message_en.properties
    But the language was not changed by changing the url language parameter
    I know that this work for some controllers (I have checked out localespring1 sample) but in my application the change of language do not take place.

  7. #7
    mikmontana is offline Member
    Join Date
    Oct 2011
    Posts
    7
    Rep Power
    0

    Default Re: change locale not working - please help me

    I've resolved the issue with a filter in my web.xml.
    You can see it in appfuse(appfuse.org).

Similar Threads

  1. Line change in String is not working
    By greenhorn in forum New To Java
    Replies: 8
    Last Post: 05-30-2011, 11:17 PM
  2. how to change whole project in another language base on locale?
    By krunalpatel1410 in forum AWT / Swing
    Replies: 3
    Last Post: 09-20-2010, 08:24 AM
  3. Locale example
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 09:04 AM
  4. How ro change the locale of JVM
    By ravi.ks007@hotmail.com in forum Advanced Java
    Replies: 2
    Last Post: 12-26-2007, 06:17 AM
  5. Locale
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-16-2007, 02:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •