tags:

views:

100

answers:

0

Hi There!

I am using Spring and struts in my application. To support il8n I have created a class

public class ApplicationMessageResource extends ResourceBundle implements MessageSource {
       private static MessageSource ms = null; //Injected by spring and contains 
                                                 parentMessageSource
       protected Object handleGetObject(String key) {
            return getMessage(key, new Object[]{}, "en_US");
        }
   ........  
  }

and in the sprint context files I have specified

<bean id="messageSource" class="fullyclassified.ApplicationMessageResource">
        <property name="wrappedMessageSource" ref="parentMessageSource" />
</bean>

and I have properties files like global_resource , global_resource_fr , global_resources_en. for different locales.

All this setup works only for the "en_US" locale , if I have to support fr and other locales. I have to create ApplicationMessageResource_fr and other classes.

I am not able to understand how this works. Can I support various languages without creating any extra ApplicationMessageResource classes.

Thanks! Pratik