Thursday, December 01, 2011

Adding custom resource bundle to your spring application

Sometimes we need to add our custom resourceBundle in our alfresco share project.
Add following code block to your spring configuration file.

Let say example our file is in config/alfresco/web-extension/custom-slingshot-application-context.xml


<bean id="webscripts.test.resources" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
 <property name="resourceBundles">
 <list>
 <value>alfresco.messages.test</value>
 </list>
 </property>
 </bean> 

Or you can use following block for share.

<!-- Override WebScript Messages - add slingshot application messages -->

<bean id="webscripts.resources.actions" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
   <property name="resourceBundles">
         <list>
            <value>alfresco.messages.test</value>
         </list>
      </property>
   </bean>

test.properties file is our resourceBundle file. it should placed to  config/alfresco/messages/

No comments:

Post a Comment