google-code-export / activeweb

Automatically exported from code.google.com/p/activeweb
0 stars 0 forks source link

Add freemarker MessageTag #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
<@message key="the.message.key" param1="x", param2="y"/>
this is to replace dynamic parameters

<@message key="the.message.key" params=params/>
if there is "params" hash in context

 it should get the locale obviously off the current request

yes, and you can override locale:
<@message key="the.message.key" locale="chinese"/>
and it should fail gracefully 

Original issue reported on code.google.com by evan.leo...@gmail.com on 14 May 2012 at 7:54

GoogleCodeExporter commented 9 years ago
should print message: <snap style="display:none"> failed to find key x in 
bundle y </span>

Original comment by evan.leo...@gmail.com on 14 May 2012 at 7:54

GoogleCodeExporter commented 9 years ago
Have the tag look for a activeweb_messages.properties in the root of resources 
to start. Allow override.

Original comment by evan.leo...@gmail.com on 14 May 2012 at 7:57

GoogleCodeExporter commented 9 years ago
Example of how to override something in a registered tag:

Igor Polevoy    3:57 PM
here is an example
public class FreeMarkerConfig extends 
org.javalite.activeweb.freemarker.AbstractFreeMarkerConfig {
  @Override
  public void init() {
  //this is to override a strange FreeMarker default processing of numbers 
  getConfiguration().setNumberFormat("0.##");
  getTag("link_to").overrideContext("");
  getTag("form").overrideContext("");
  }
}

Original comment by evan.leo...@gmail.com on 14 May 2012 at 7:58

GoogleCodeExporter commented 9 years ago
How's this? (patch attached)

Original comment by evan.leo...@gmail.com on 15 May 2012 at 1:46

Attachments:

GoogleCodeExporter commented 9 years ago
I chose not to implement overriding the bundle in the messagetag config because 
I would like that setting to apply to the default bundle in the controllers as 
well.

Also, the Messages class is a close dup of what's in AJ. There might be 
something there to factor out into javalite common.

Original comment by evan.leo...@gmail.com on 15 May 2012 at 1:52

GoogleCodeExporter commented 9 years ago
this was fixed some time ago

Original comment by i...@polevoy.org on 4 Nov 2012 at 8:28

GoogleCodeExporter commented 9 years ago

Original comment by i...@polevoy.org on 4 Nov 2012 at 8:29