PDA

View Full Version : MultiLanguage Spring Application



badhu
Mar 1st, 2006, 01:16 AM
Hi All,

We are developing a MultiLanguage Application in Spring Framework. When i use the

<bean id="ms" class="org.springframework.context.support.ResourceBundle MessageSource">
<property name="basenames">
<list>
<value>msg1</value>
<value>msg2</value>
<value>msg3</value>
</list>
</property>
</bean>

ResourceBundleMessageSource, All the Label in my UI is loded through the Above Property files. If i want to change the Another Language like French What i have to do?


Thanks in Advance.
Badhu

shahzad992
Mar 1st, 2006, 04:18 AM
hi,

Do the follwoinbg things in ur projectname-Servlet.xml

<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeI nterceptor">
<property name="paramName"><value>siteLanguage</value></property>
</bean>

<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocale Resolver"/>


after this add the localeChangeInterceptor in url mappings.



Regards,
Shahzad

badhu
Mar 1st, 2006, 05:44 AM
Hello Shahzad


I Have to specify the

<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.Locale ChangeInterceptor">
<property name="paramName"><value>siteLanguage</value></property>
</bean>

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.Sessio nLocaleResolver"/>

the above <bean> tag in my application-servlet.xml file. After the URL mapping.

Instead of siteLanguage can i put us / fr / ar something like this.

In my Application i used more than one ApplicationContext files i specified in my web.xml.

Can i add the above <bean> tags in my applicationContext.xml file.

Pls give ur suggestion.

Thanks in Advance
Badhu

shahzad992
Mar 1st, 2006, 10:24 PM
Hi,

You can do this in Application Conext XMl.

<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocale Resolver"/>


Regards,

Shahzad

Dosihris
Mar 14th, 2007, 07:16 PM
Can you please explain more details?

i put the localeChangeInterceptor bean and the localeResolver in my springdispatcher-servlet.xml.

How can i now load all my text from the database???