cancel
Showing results for 
Search instead for 
Did you mean: 

freemarker inclusions in properties files

scouil
Star Contributor
Star Contributor
Hello,

I'm currently working on a project involving several home-made webscripts.
I internationalize those by using the classic  .<method>.properties files.

I noticed that, obviously, some of my language strings were the same across all those webscript so I tried to include them in a 'global.properties' file and tried to include it on each webscript.
So I tried a classic freemarker <#include "../myPath/global.properties" /> in my  .<method>.properties   however the strings aren't available.
Since I double checked the path was fine before posting, I suppose that freemarker doesn't parse the properties files.

So I currently have 2 options:
  - appending my shared strings to <TOMCAT HOME>/webapps/alfresco/WEB-INF/classes/alfresco/messages/templates-messages.properties
  - copy/pasting my shared strings in each of my properties files

And as you can guess, none of those satisfy me.
Is there something I'm missing? Some kind of workaround?

Thanks,
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

property files are handled according to the Java standard defined for them - no FreeMarker processing is going on here.
When you want to be able to use fragments as globally defined, reusable I18n, you should use the ResourceBundleBootstrapComponent of Spring Surf / Alfresco, and include it in one of your Spring bean configuration files (e.g. custom-application-context.xml). The following wiki page is a bit out-of-date for the more recent Alfresco versions, but still relevant: http://wiki.alfresco.com/wiki/I18N#Registering_a_resource_bundle.

Regards
Axel

scouil
Star Contributor
Star Contributor
Thanks for answering.

I was hoping for a solution where the file is uploaded to alfresco since I find it easier to modify/redeploy this way.
But your solution is the cleanest I have for now.
I'll leave the post open for a week hoping for some other solution. I'll mark it as solved after that if I get no answer to give you your deserved point Smiley Happy

Regards,