Override resource message of the default ACS

cancel
Showing results for 
Search instead for 
Did you mean: 
jamilnour
Established Member

Override resource message of the default ACS

Hello,

Is it possible to override the resource file "invitation-service.properties" from my plugin (amp)?

It is used when a user is invited to a library and I want to do changes in the body of the message and support more languages

Thanks

Jamil

6 Replies
jljwoznica
Senior Member

Re: Override resource message of the default ACS

Can you just change the file and update the information appropriately?

# InviteSender messages
invitation.invitesender.email.subject=Alfresco {0}: You have been invited to join the {1} site
invitation.invitesender.email.role.SiteManager=Site Manager
invitation.invitesender.email.role.SiteCollaborator=Site Collaborator
invitation.invitesender.email.role.SiteContributor=Site Contributor
invitation.invitesender.email.role.SiteConsumer=Site Consumer
jamilnour
Established Member

Re: Override resource message of the default ACS

The file is embeded inside the alfresco-repository-6.1.jar. How I can change it and preserve the auto update of ACS?

I tried to add the properties to my amp and define the new path inside the boostrap-context.xml but nothing changed and ACS keeps using the file from the repository jar

<property name="labels">
<list>
<!-- Bootstrap Resource Bundles for the content model types, aspects, properties etc -->
<value>alfresco/module/${project.artifactId}/messages/invitation-service.properties</value>
</list>
</property>

any idea?

Jamil

narkuss
Established Member II

Re: Override resource message of the default ACS

First of all, I've always seen the resource labels list without the .properties :

<property name="labels">
    <list>
        <!-- Bootstrap Resource Bundles for the content model types, aspects, properties etc -->
        <value>alfresco/module/${project.artifactId}/messages/invitation-service</value>
    </list>
</property>

But looking at alfresco-repository, there's a file invitation-service-context.xml:

https://github.com/Alfresco/alfresco-repository/blob/master/src/main/resources/alfresco/invitation-s...

Here, there's a bean definition to take the messages from a path:

<bean id="invitationResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
    	<property name="resourceBundles">
    		<list>
    			<value>alfresco.messages.invitation-service</value>
    		</list>
    	</property>
   </bean>

I think you could override this bean in your bootstrap-context.xml file, and point the location of this invitation-service.properties file to your custom location.

Hope it helps.

abhinavmishra14
Advanced

Re: Override resource message of the default ACS

As mentioned by 

invitation.invitesender.email.subject=Alfresco {0}: You have been invited to join the {1} site

 you can simply override the property in your property file which is in your custom amp. for example if you have "your-module-messages.properties" file in your custom module. you can add the above given key in your custom file. 

invitation.invitesender.email.subject= Your Project {0}: You have been invited to join the {1} site, Please use the link.

And your custom property file would be configured like:

<bean id="mycustom.module.resources" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco/module/${project.artifactId}/messages/your-module-messages</value>
</list>
</property>
</bean>

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
jamilnour
Established Member

Re: Override resource message of the default ACS

It works. Thank you

One more question please

When the other _xx properties version will be used by ACS? I have always the english default version used

Changing the language on the client Share is working well but on the server (ACS) how it works? (email templates, properties etc..)

Am I missing something?

Jamil

abhinavmishra14
Advanced

Re: Override resource message of the default ACS

You can very well create localized properties. e.g.

your-module-messages_en.properties

your-module-messages_es.properties

your-module-messages_fr.properties

your-module-messages_de.properties

your-module-messages_it.properties

your-module-messages_ja.properties

...... etc.

All you need to do is to keep the localized values for the keys you are using.

E.g. for spanish version of properties file: "your-module-messages_es.properties"

Key will be same but value would be in spanish.

invitation.invitesender.email.subject= Su proyecto {0}: ha sido invitado a unirse al sitio {1}. Utilice el enlace.

Same way you can use the same key for other versions of properties files.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)