title: Resolving spring:messages in javascript for i18n internationalization
body: <p>I'm attempting to internationalize some of our code. I have a page in JSPX which is using the <code>&lt;spring:message&gt;</code> tag to resolve strings from a <code>message.properties</code> 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 <code>&lt;spring:message&gt;</code> tag for the string in there just means that it gets printed out verbatim. </p>
  
  <p>My JSPX sources the javascript like so:</p>
  
  <pre><code>&lt;spring:theme code="jsFile" var="js" /&gt;
  &lt;script type="text/javascript" src="${js}" /&gt;
  </code></pre>
  
  <p>The JS where I'm looking the replace the string is below:</p>
  
  <pre><code>buildList('settings', [{
      name: '&lt;spring:message code="proj.settings.toggle" javaScriptEscape="true" /&gt;',
      id:"setting1",
      description: '&lt;spring:message code="proj.settings.toggle.description" javaScriptEscape="true" /&gt;',
      installed: true
  }]);
  </code></pre>
  
  <p>And finally the message.properties is something like:</p>
  
  <pre><code>proj.settings.toggle=Click here to toggle
  proj.settings.toggle.description=This toggles between on and off
  </code></pre>
  
  <p>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?</p>
  
  <p>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.</p>
  
  <p>Thanks for any help!</p>