cancel
Showing results for 
Search instead for 
Did you mean: 

overriding messages in property files

vamirr
Champ on-the-rise
Champ on-the-rise
I have some small edits I'd like to make to the Share messages stored in property files.  Is it possible to do this from the extension directory (tomcat/shared/classes/alfresco)?

For example, I'd like to change the title site invitation email.  The current title is defined by invitation.invitesender.email.subject  in  tomcat/webapps/alfresco/WEB-INF/classes/alfresco/messages/invitation-service_en_US.properties

I'd like to edit this file while placing it into the extension directory: tomcat/shared/classes/alfresco/extension/messages/invitation-service_en_US.properties

Webscripts can be overridden via the extension directory, but it seems like this is not the case for this properties file.  Can this be corrected via some other mechanism?
2 REPLIES 2

vamirr
Champ on-the-rise
Champ on-the-rise
Ok, so here's how you do it:


Create two spring beans:


$TOMCAT_HOME/shared/classes/alfresco/web-extension/messages-extension-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN'
   'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <bean id="webscripts.resources"
         class="org.alfresco.i18n.ResourceBundleBootstrapComponent">

      <property name="resourceBundles">
         <list>
            <value>webscripts.messages.webscripts</value>
            <value>alfresco.messages.common</value>
            <value>alfresco.messages.slingshot</value>
            <value>alfresco.web-extension.messages.myOverridingResourceBundle</value>
         </list>
      </property>
   </bean>
</beans>


$TOMCAT_HOME/shared/classes/alfresco/extension/messages-extension-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN'
   'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <bean id="webscripts.resources"
         class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>alfresco.extension.messages.myOverridingResourceBundle</value>
         </list>
      </property>
   </bean>
</beans>


Create messages folders for both ext and web-ext:
$TOMCAT_HOME/shared/classes/alfresco/extension/messages
$TOMCAT_HOME/shared/classes/alfresco/web-extension/messages

In each messages folder, put your new properties file:
$TOMCAT_HOME/shared/classes/alfresco/extension/messages/myOverridingResourceBundle.properties
$TOMCAT_HOME/shared/classes/alfresco/web-extension/messages/myOverridingResourceBundle.properties

In the extension properties file, put your override for the email title:
invitation.invitesender.email.subject=My New Site Invitation Email Title: {0}



Note that for the Share Site Invitation email, you don't need to do the web-extension side of this exercise at all.  I did it as I had other Share specific messages that I wanted to override and doing both right here gave me the ground work for those.

For example, I wanted to change the Share Title Page.   In my $TOMCAT_HOME/shared/classes/alfresco/web-extension/messages/myOverridingResourceBundle.properties, I have:  

page.title=My New Share Title Page &raquo; {0}

rquinga
Champ in-the-making
Champ in-the-making
For recent activities, that code it should add? in alfresco community 4.2.f

Regards