Customise how properties files are used in Share webscripts

cancel
Showing results for 
Search instead for 
Did you mean: 
marco_altieri
Active Member II

Customise how properties files are used in Share webscripts

Jump to solution

In Alfresco Share, web scripts can use ".properties" files for the internationalization. 

Each web script can define its properties files with custom messages.

I need to customise this functionality to use the same properties for all the web scripts (even pre-existing web scripts that I can't or I do not want to change).

I am wondering if someone knows from what class I should start looking.

What I want to achieve is to "alter" the object msg that is available in the free marker template so I can modify the default translations.

UPDATE:

It seems that a class used in managing the messages is org.springframework.extensions.webscripts.MessageMethod that extends the class org.springframework.extensions.webscripts.AbstractMessageHelper.

Does anyone know how to provide a custom instance of MessageMethod ?

1 Solution

Accepted Solutions
afaust
Master

Re: Customise how properties files are used in Share webscripts

Jump to solution

The msg / message object already looks up messages from global, shared message bundles. The web script local properties-files only override what is available in the global ones, so as long as you don't use web script local files for I18n and bootstrap all messages into the global scope, you already have the functionality that you are looking for.

If you want to make pre-existing web scripts use the global bundles, the simples way would be by filtering the WAR resource and removing the pre-package web script properties files (after you provided the same messages in the global scope, of course).

View solution in original post

2 Replies
afaust
Master

Re: Customise how properties files are used in Share webscripts

Jump to solution

The msg / message object already looks up messages from global, shared message bundles. The web script local properties-files only override what is available in the global ones, so as long as you don't use web script local files for I18n and bootstrap all messages into the global scope, you already have the functionality that you are looking for.

If you want to make pre-existing web scripts use the global bundles, the simples way would be by filtering the WAR resource and removing the pre-package web script properties files (after you provided the same messages in the global scope, of course).

marco_altieri
Active Member II

Re: Customise how properties files are used in Share webscripts

Jump to solution

Thank you for your answer.

It is useful to know that you think that there isn't a clean way to do it.

I do need to modify pre-existing web scripts and what you have suggested should work.

I will continue to look for a solution that does not require touching the resources in the war file and if I do not find it, we will decide if it is worth to extract the labels from the war files or we can live without being able to change them (I know that it is possible to change them providing alternative files in the extension path, but in my use case, this is not feasible).