Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Marking messages in jelly files

Your jelly files in src/main/resources often contain messages that need to be localized, and those need to be marked as well.

In the simplest case, suppose you have a part of a Jelly file that looks like the following:

No Format


Then all you need to do is to change this to the following:

No Format


The ${%...} marker indicates stapler to look for localized resources, and when none is found it'll just print "Output" for this, which is what you want.

Let's consider the case where the localization requires parameters. Suppose you have a Jelly file foo.jelly like this:

No Format

<p>Click <a href="${obj.someMethod(a,b,c)}">here</a></p>

In this case, first you have to write for the default locale:

No Format <a href="{0}">here</a>

Then update foo.jelly to refer to this like this:

No Format


If you have multiple parameters you can pass them by separating ',' (just like a function call), and from property files you can reference them as {0}, {1}, etc., by following the MessageFormat class convention.