I'm attempting to internationalize some of our code. I have a page in JSPX which is using the <spring:message>
tag to resolve strings from a message.properties
file. This works fine for the HTML and CSS that is in the JSPX page, however there a javascript file is sourced, and substituting the <spring:message>
tag for the string in there just means that it gets printed out verbatim.
My JSPX sources the javascript like so:
<spring:theme code=jsFile var=js />
<script type=text/javascript src=${js} />
The JS where I'm looking the replace the string is below:
buildList('settings', [{
name: '<spring:message code=proj.settings.toggle javaScriptEscape=true />',
id:setting1,
description: '<spring:message code=proj.settings.toggle.description javaScriptEscape=true />',
installed: true
}]);
And finally the message.properties is something like:
proj.settings.toggle=Click here to toggle
proj.settings.toggle.description=This toggles between on and off
So what I'm wondering is, should this work? It seems to me like it should, from what I've gathered on various forums, but I can't figure out where I'm going wrong. Is there a better way to go about this?
I should also note that these files are outside the WEB-INF folder, but by placing the ReloadableResourceBundleMessageSource in the root applicationContext.xml the spring tags are picked up.
Thanks for any help!