spring - Thymeleaf: Use the text content as default if the message resolver fails -


I recently started using i18n with Thimmelef and Spring 4, like:

< Pre> & lt; Span th: text = "# {foo.bar}" & gt; Foo Bar & lt; / Span & gt;

Is there a way to display thymelef actually "foo bar" if the user is not having the foo.bar key for the location?

This is the current configuration I have:

  @bean public message processing message source () {reloadable resourcebundled message source message source = new reloadable resourcebundle Message Source (); MessageSource.setBasenames ("/ web-INF / messages / messages"); MessageSource.setUseCodeAsDefaultMessage (true); // something equal? MessageSource.setDefaultEncoding ("UTF-8"); MessageSource.setCacheSeconds (0); Return messages source; }  

The message source is the last resort to prevent CODEAsDefaultMessage properties an exception code Mapping Infidelity (If MessageSource can not find your code mapping, then this Noose Message throws an exception). This is for development and debugging, so there is no clear way to do this normally because it is not a good practice to use a defined message code anywhere.


Comments

Popular posts from this blog

mysql - How to enter php data into a html multiple select box -

java - Can't add JTree to JPanel of a JInternalFrame -

c++ - Cassandra datastax cpp driver - avoiding unnecessary copies -