Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2009-03-06 15:53:12 -0500
committerpelder2009-03-06 15:53:12 -0500
commit351fe3fe106ac81c45c005d8acf9986a4d58b664 (patch)
tree21d3889cfcf5cf979b0c01ced60c2c68036c1f78
parentfeac5f6f4a4a14a4828537a60358f00d3097d2cc (diff)
downloadorg.eclipse.jet-351fe3fe106ac81c45c005d8acf9986a4d58b664.tar.gz
org.eclipse.jet-351fe3fe106ac81c45c005d8acf9986a4d58b664.tar.xz
org.eclipse.jet-351fe3fe106ac81c45c005d8acf9986a4d58b664.zip
[267441] Support localization of JET templates
-rw-r--r--doc/org.eclipse.jet.doc/references/taglibs/formatTags/bundleTag.html74
-rw-r--r--doc/org.eclipse.jet.doc/references/taglibs/formatTags/messageTag.html79
-rw-r--r--doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html35
-rw-r--r--doc/org.eclipse.jet.doc/references/taglibs/formatTags/paramTag.html74
-rw-r--r--doc/org.eclipse.jet.doc/references/taglibs/formatTags/setBundleTag.html69
-rw-r--r--doc/org.eclipse.jet.doc/references/taglibs/formatTags/setLocaleTag.html81
-rw-r--r--doc/org.eclipse.jet.doc/tocformatTags.xml5
-rw-r--r--plugins/org.eclipse.jet/plugin.xml116
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java2
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/BundleTag.java59
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/MessageTag.java110
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/Messages.java47
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/ParamTag.java89
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/ResourceBundleUtil.java109
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/SetBundleTag.java45
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/SetLocaleTag.java47
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java19
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/messages.properties18
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java2
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java2
-rw-r--r--plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jarbin36817 -> 36830 bytes
-rw-r--r--transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--transforms/org.eclipse.jet.transforms.taglibdoc/templates/tagLibrary/overview.html.jet2
23 files changed, 1079 insertions, 7 deletions
diff --git a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/bundleTag.html b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/bundleTag.html
new file mode 100644
index 0000000..52851e5
--- /dev/null
+++ b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/bundleTag.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META name="GENERATOR" content="IBM Software Development Platform">
+<link rel="STYLESHEET" href="../../../book.css" charset="ISO-8859-1" type="text/css"/>
+<TITLE>&lt;f:bundle&gt; - Standard JET2 Format Tags</TITLE>
+</HEAD>
+<BODY>
+<TABLE border="0" cellpadding="0" cellspacing="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH align="left">
+ <P>&lt;f:bundle&gt;</P></TH>
+ <TH align="right"><A href="overview.html">Standard JET2 Format Tags</A></TH>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<P><B>bundle</B></P>
+<P><P> Define the message bundle from which contained f:message tags will retrieve messages.<P><P>The actual bundle loaded will be influenced by the default locale, which may be changed via the f:setLocale tag.<P> </P>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Tag Summary</TH></TR>
+ <TR>
+ <TD width="10%">required</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:bundle basename=&quot;<I>value</I>&quot;&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;<I>content to be written</I><BR>
+ &lt;/f:bundle&gt;
+ </SPAN></TD>
+ </TR>
+ <TR>
+ <TD width="10%">full tag</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:bundle basename=&quot;<I>value</I>&quot;&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;<I>content to be written</I><BR>
+ &lt;/f:bundle&gt;
+ </SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Required Attributes</TH></TR>
+ <TR>
+ <TD width="10%">basename</TD>
+ <TD><BR> The base name of the message bundle. This is either JET project relative template path of a message bundle file (without the .properties extension), or a fully qualified Java class name.<BR>Fully qualified Java class names are resolved via java.util.ResourceBundle.getBundle(). See the method documentation for details.<BR> </TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Example</TH></TR>
+ <TR>
+ <TD width="10%"></TD>
+ <TD><SPAN style="font-family: monospace">
+<!-- Begin bundle example -->
+ &lt;f:bundle basename=&quot;<I>templates/messages</I>&quot;&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&lt;f:message key="helloWorld"&gt;&lt;f:param value="Bob"/&gt;&lt;/f:message&gt;<BR>
+ &lt;/f:bundle&gt;
+<!-- End bundle example -->
+</SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<P></P></BODY>
+</HTML>
diff --git a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/messageTag.html b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/messageTag.html
new file mode 100644
index 0000000..f0d9ca7
--- /dev/null
+++ b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/messageTag.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META name="GENERATOR" content="IBM Software Development Platform">
+<link rel="STYLESHEET" href="../../../book.css" charset="ISO-8859-1" type="text/css"/>
+<TITLE>&lt;f:message&gt; - Standard JET2 Format Tags</TITLE>
+</HEAD>
+<BODY>
+<TABLE border="0" cellpadding="0" cellspacing="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH align="left">
+ <P>&lt;f:message&gt;</P></TH>
+ <TH align="right"><A href="overview.html">Standard JET2 Format Tags</A></TH>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<P><B>message</B></P>
+<P><P> Retrieve a message from a message bundle and either write it or store it in a variable. <P><P>The message bundle may be defined by either a containing f:bundle tag or identified by the f:setBundle tag. <P><P>If the message is parameterized, parameter values are defined by contained f:param tags.<P> </P>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Tag Summary</TH></TR>
+ <TR>
+ <TD width="10%">required</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:message&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;<I>content to be written</I><BR>
+ &lt;/f:message&gt;
+ </SPAN></TD>
+ </TR>
+ <TR>
+ <TD width="10%">full tag</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:message key=&quot;<I>value</I>&quot; var=&quot;<I>value</I>&quot;&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;<I>content to be written</I><BR>
+ &lt;/f:message&gt;
+ </SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Optional Attributes</TH></TR>
+ <TR>
+ <TR>
+ <TD width="10%">key</TD>
+ <TD><BR> The key for a resource bundle message. If omitted, the body content of the tag is used to create the key.<BR> </TD>
+ </TR>
+ <TR>
+ <TD width="10%">var</TD>
+ <TD><BR> a variable that will be set to the message. If omitted, the message is writen to the tag output.<BR> </TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Example</TH></TR>
+ <TR>
+ <TD width="10%"></TD>
+ <TD><SPAN style="font-family: monospace">
+<!-- Begin message example -->
+ &lt;f:message key="helloWorld"&gt;&lt;f:param value="Bob"/&gt;&lt;/f:message&gt;<BR>
+ &lt;f:message&gt;helloWorld&lt;f:param value="Bob"/&gt;&lt;/f:message&gt;<BR>
+ &lt;f:message key="helloWorld" var="msg"&gt;&lt;f:param value="Bob"/&gt;&lt;/f:message&gt;<BR>
+<!-- End message example -->
+</SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<P></P></BODY>
+</HTML>
diff --git a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html
index b9ee76c..2dc8767 100644
--- a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html
+++ b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html
@@ -25,6 +25,13 @@
<TR>
<TH colspan="2" align="left">Tag Summary</TH></TR>
<TR>
+ <TD width="10%"><A href="bundleTag.html">&lt;f:bundle&gt;</A></TD>
+ <TD><!-- Begin bundle description -->
+ <P> Define the message bundle from which contained f:message tags will retrieve messages
+ <!-- End bundle description -->
+ </TD>
+ </TR>
+ <TR>
<TD width="10%"><A href="formatNowTag.html">&lt;f:formatNow&gt;</A></TD>
<TD><!-- Begin formatNow description -->
Formats and writes out the current date and time
@@ -46,6 +53,13 @@
</TD>
</TR>
<TR>
+ <TD width="10%"><A href="messageTag.html">&lt;f:message&gt;</A></TD>
+ <TD><!-- Begin message description -->
+ <P> Retrieve a message from a message bundle and either write it or store it in a variable
+ <!-- End message description -->
+ </TD>
+ </TR>
+ <TR>
<TD width="10%"><A href="millisecondsTag.html">&lt;f:milliseconds&gt;</A></TD>
<TD><!-- Begin milliseconds description -->
Writes out a current system milliseconds value
@@ -53,6 +67,13 @@
</TD>
</TR>
<TR>
+ <TD width="10%"><A href="paramTag.html">&lt;f:param&gt;</A></TD>
+ <TD><!-- Begin param description -->
+ <P> Define a parameter value for a containing f:message tag
+ <!-- End param description -->
+ </TD>
+ </TR>
+ <TR>
<TD width="10%"><A href="replaceAllTag.html">&lt;f:replaceAll&gt;</A></TD>
<TD><!-- Begin replaceAll description -->
<P> Replace all instances of a value in the tag's content with a new value
@@ -60,6 +81,20 @@
</TD>
</TR>
<TR>
+ <TD width="10%"><A href="setBundleTag.html">&lt;f:setBundle&gt;</A></TD>
+ <TD><!-- Begin setBundle description -->
+ <P> Define the default message bundle to be used by all f:message tags in all JET templates
+ <!-- End setBundle description -->
+ </TD>
+ </TR>
+ <TR>
+ <TD width="10%"><A href="setLocaleTag.html">&lt;f:setLocale&gt;</A></TD>
+ <TD><!-- Begin setLocale description -->
+ <P> Define the language locale to be used when loading message bundles with the f:bundle and f:setBundle tags
+ <!-- End setLocale description -->
+ </TD>
+ </TR>
+ <TR>
<TD width="10%"><A href="stripTag.html">&lt;f:strip&gt;</A></TD>
<TD><!-- Begin strip description -->
<P> *** DEPRECATED *** Strip all whitespace from the content
diff --git a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/paramTag.html b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/paramTag.html
new file mode 100644
index 0000000..83a9229
--- /dev/null
+++ b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/paramTag.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META name="GENERATOR" content="IBM Software Development Platform">
+<link rel="STYLESHEET" href="../../../book.css" charset="ISO-8859-1" type="text/css"/>
+<TITLE>&lt;f:param&gt; - Standard JET2 Format Tags</TITLE>
+</HEAD>
+<BODY>
+<TABLE border="0" cellpadding="0" cellspacing="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH align="left">
+ <P>&lt;f:param&gt;</P></TH>
+ <TH align="right"><A href="overview.html">Standard JET2 Format Tags</A></TH>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<P><B>param</B></P>
+<P><P> Define a parameter value for a containing f:message tag. <P><P>If the value attribute is defined, then this defines the parameter value. Otherwise, the tag's body content defines the parameter value.<P><P>This tag must be contained within a f:message tag, or a runtime error will occur.<P> </P>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Tag Summary</TH></TR>
+ <TR>
+ <TD width="10%">required</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:param&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;<I>content to be written</I><BR>
+ &lt;/f:param&gt;
+ </SPAN></TD>
+ </TR>
+ <TR>
+ <TD width="10%">full tag</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:param value=&quot;<I>value</I>&quot;&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;<I>content to be written</I><BR>
+ &lt;/f:param&gt;
+ </SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Optional Attributes</TH></TR>
+ <TR>
+ <TR>
+ <TD width="10%">value</TD>
+ <TD><BR> The parameter value. If omitted, the tag's body content is used as the parameter value.<BR> </TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Example</TH></TR>
+ <TR>
+ <TD width="10%"></TD>
+ <TD><SPAN style="font-family: monospace">
+<!-- Begin param example -->
+ &lt;f:message key="helloWorld"&gt;&lt;f:param value="Bob"/&gt;&lt;/f:message&gt;<BR>
+ &lt;f:message key="helloWorld"&gt;&lt;f:param&gt;Bob&lt;/f:param&gt;&lt;/f:message&gt;<BR>
+<!-- End param example -->
+</SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<P></P></BODY>
+</HTML>
diff --git a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/setBundleTag.html b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/setBundleTag.html
new file mode 100644
index 0000000..b30348e
--- /dev/null
+++ b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/setBundleTag.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META name="GENERATOR" content="IBM Software Development Platform">
+<link rel="STYLESHEET" href="../../../book.css" charset="ISO-8859-1" type="text/css"/>
+<TITLE>&lt;f:setBundle&gt; - Standard JET2 Format Tags</TITLE>
+</HEAD>
+<BODY>
+<TABLE border="0" cellpadding="0" cellspacing="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH align="left">
+ <P>&lt;f:setBundle&gt;</P></TH>
+ <TH align="right"><A href="overview.html">Standard JET2 Format Tags</A></TH>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<P><B>setBundle</B></P>
+<P><P> Define the default message bundle to be used by all f:message tags in all JET templates.<P> </P>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Tag Summary</TH></TR>
+ <TR>
+ <TD width="10%">required</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:setBundle basename=&quot;<I>value</I>&quot;/&gt;<br>
+ </SPAN></TD>
+ </TR>
+ <TR>
+ <TD width="10%">full tag</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:setBundle basename=&quot;<I>value</I>&quot;/&gt;<br>
+ </SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Required Attributes</TH></TR>
+ <TR>
+ <TD width="10%">basename</TD>
+ <TD><BR> The base name of the message bundle. This is either JET project relative template path of a message bundle file (without the .properties extension), or a fully qualified Java class name.<BR>Fully qualified Java class names are resolved via java.util.ResourceBundle.getBundle(). See the method documentation for details.<BR> </TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Example</TH></TR>
+ <TR>
+ <TD width="10%"></TD>
+ <TD><SPAN style="font-family: monospace">
+<!-- Begin setBundle example -->
+ &lt;f:setBundle basename=&quot;templates/messages&quot;/&gt;<br>
+ &lt;f:setBundle basename=&quot;org.example.l10n.Messages&quot;/&gt;<br>
+<!-- End setBundle example -->
+</SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<P></P></BODY>
+</HTML>
diff --git a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/setLocaleTag.html b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/setLocaleTag.html
new file mode 100644
index 0000000..fc738fe
--- /dev/null
+++ b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/setLocaleTag.html
@@ -0,0 +1,81 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META name="GENERATOR" content="IBM Software Development Platform">
+<link rel="STYLESHEET" href="../../../book.css" charset="ISO-8859-1" type="text/css"/>
+<TITLE>&lt;f:setLocale&gt; - Standard JET2 Format Tags</TITLE>
+</HEAD>
+<BODY>
+<TABLE border="0" cellpadding="0" cellspacing="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH align="left">
+ <P>&lt;f:setLocale&gt;</P></TH>
+ <TH align="right"><A href="overview.html">Standard JET2 Format Tags</A></TH>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<P><B>setLocale</B></P>
+<P><P> Define the language locale to be used when loading message bundles with the f:bundle and f:setBundle tags.<P><P>See the documentation for the Java class java.util.Locale for details on language codes, country codes and locale variants.<P> </P>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Tag Summary</TH></TR>
+ <TR>
+ <TD width="10%">required</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:setLocale value=&quot;<I>value</I>&quot;/&gt;<br>
+ </SPAN></TD>
+ </TR>
+ <TR>
+ <TD width="10%">full tag</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:setLocale value=&quot;<I>value</I>&quot; variant=&quot;<I>value</I>&quot;/&gt;<br>
+ </SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Required Attributes</TH></TR>
+ <TR>
+ <TD width="10%">value</TD>
+ <TD><BR> A string representing the locale, which must contain a two-letter (lower-case) language code (as defined by ISO-639), and optionally followed by a two-letter (upper-case) country code (as defined by ISO-3166). The language and country codes must be separated by an underscore(_) or a hyphen(-).<BR> </TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Optional Attributes</TH></TR>
+ <TR>
+ <TR>
+ <TD width="10%">variant</TD>
+ <TD><BR> An optional locale variant.<BR> </TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Example</TH></TR>
+ <TR>
+ <TD width="10%"></TD>
+ <TD><SPAN style="font-family: monospace">
+<!-- Begin setLocale example -->
+ &lt;f:setLocale value=&quot;en_CA&quot;/&gt;<br>
+ &lt;f:setLocale value=&quot;fr&quot;/&gt;<br>
+<!-- End setLocale example -->
+</SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<P></P></BODY>
+</HTML>
diff --git a/doc/org.eclipse.jet.doc/tocformatTags.xml b/doc/org.eclipse.jet.doc/tocformatTags.xml
index 3ae4997..a27c7f3 100644
--- a/doc/org.eclipse.jet.doc/tocformatTags.xml
+++ b/doc/org.eclipse.jet.doc/tocformatTags.xml
@@ -13,5 +13,10 @@
<topic label="f:unique" href="references/taglibs/formatTags/uniqueTag.html"/>
<topic label="f:uuid" href="references/taglibs/formatTags/uuidTag.html"/>
<topic label="f:xpath" href="references/taglibs/formatTags/xpathTag.html"/>
+ <topic label="f:message" href="references/taglibs/formatTags/messageTag.html"/>
+ <topic label="f:param" href="references/taglibs/formatTags/paramTag.html"/>
+ <topic label="f:bundle" href="references/taglibs/formatTags/bundleTag.html"/>
+ <topic label="f:setBundle" href="references/taglibs/formatTags/setBundleTag.html"/>
+ <topic label="f:setLocale" href="references/taglibs/formatTags/setLocaleTag.html"/>
</topic>
</toc>
diff --git a/plugins/org.eclipse.jet/plugin.xml b/plugins/org.eclipse.jet/plugin.xml
index b567fc9..2b6f064 100644
--- a/plugins/org.eclipse.jet/plugin.xml
+++ b/plugins/org.eclipse.jet/plugin.xml
@@ -1050,6 +1050,122 @@ If the variable &apos;org.eclipse.jet.formatTags.test&apos; is defined, the tag
</description>
</attribute>
</functionTag>
+ <containerTag
+ allowAsEmpty="true"
+ class="org.eclipse.jet.internal.taglib.format.MessageTag"
+ name="message"
+ processContents="custom"
+ whenContainingLineIsEmpty="remove">
+ <attribute
+ name="key"
+ type="string"
+ use="optional">
+ <description>
+ The key for a resource bundle message. If omitted, the body content of the tag is used to create the key.
+ </description>
+ </attribute>
+ <attribute
+ name="var"
+ type="string"
+ use="optional">
+ <description>
+ a variable that will be set to the message. If omitted, the message is writen to the tag output.
+ </description>
+ </attribute>
+ <description>
+ Retrieve a message from a message bundle and either write it or store it in a variable.
+
+The message bundle may be defined by either a containing f:bundle tag or identified by the f:setBundle tag.
+
+If the message is parameterized, parameter values are defined by contained f:param tags.
+ </description>
+ </containerTag>
+ <containerTag
+ allowAsEmpty="true"
+ class="org.eclipse.jet.internal.taglib.format.ParamTag"
+ name="param"
+ processContents="custom"
+ whenContainingLineIsEmpty="remove">
+ <attribute
+ name="value"
+ type="string"
+ use="optional">
+ <description>
+ The parameter value. If omitted, the tag&apos;s body content is used as the parameter value.
+ </description>
+ </attribute>
+ <description>
+ Define a parameter value for a containing f:message tag.
+
+If the value attribute is defined, then this defines the parameter value. Otherwise, the tag&apos;s body content defines the parameter value.
+
+This tag must be contained within a f:message tag, or a runtime error will occur.
+ </description>
+ </containerTag>
+ <containerTag
+ allowAsEmpty="false"
+ class="org.eclipse.jet.internal.taglib.format.BundleTag"
+ name="bundle"
+ processContents="standard"
+ whenContainingLineIsEmpty="remove">
+ <description>
+ Define the message bundle from which contained f:message tags will retrieve messages.
+
+The actual bundle loaded will be influenced by the default locale, which may be changed via the f:setLocale tag.
+ </description>
+ <attribute
+ name="basename"
+ type="string"
+ use="required">
+ <description>
+ The base name of the message bundle. This is either JET project relative template path of a message bundle file (without the .properties extension), or a fully qualified Java class name.
+Fully qualified Java class names are resolved via java.util.ResourceBundle.getBundle(). See the method documentation for details.
+ </description>
+ </attribute>
+ </containerTag>
+ <emptyTag
+ class="org.eclipse.jet.internal.taglib.format.SetBundleTag"
+ name="setBundle"
+ whenContainingLineIsEmpty="remove">
+ <description>
+ Define the default message bundle to be used by all f:message tags in all JET templates.
+ </description>
+ <attribute
+ name="basename"
+ type="string"
+ use="required">
+ <description>
+ The base name of the message bundle. This is either JET project relative template path of a message bundle file (without the .properties extension), or a fully qualified Java class name.
+Fully qualified Java class names are resolved via java.util.ResourceBundle.getBundle(). See the method documentation for details.
+ </description>
+ </attribute>
+ </emptyTag>
+ <emptyTag
+ class="org.eclipse.jet.internal.taglib.format.SetLocaleTag"
+ name="setLocale"
+ whenContainingLineIsEmpty="remove">
+ <description>
+ Define the language locale to be used when loading message bundles with the f:bundle and f:setBundle tags.
+
+See the documentation for the Java class java.util.Locale for details on language codes, country codes and locale variants.
+ </description>
+ <attribute
+ name="value"
+ type="string"
+ use="required">
+ <description>
+ A string representing the locale, which must contain a two-letter (lower-case) language code (as defined by ISO-639), and optionally followed by a two-letter (upper-case) country code (as defined by ISO-3166). The language and country codes must be separated by an underscore(_) or a hyphen(-).
+ </description>
+ </attribute>
+ <attribute
+ name="variant"
+ type="string"
+ use="optional">
+ <description>
+ An optional locale variant.
+ </description>
+ </attribute>
+ </emptyTag>
</tagLibrary>
</extension>
<extension
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java
index fcdc617..c09d6b9 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/BundleTag.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/BundleTag.java
new file mode 100644
index 0000000..0b12dc7
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/BundleTag.java
@@ -0,0 +1,59 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: BundleTag.java,v 1.1 2009/03/06 20:53:09 pelder Exp $
+ */
+package org.eclipse.jet.internal.taglib.format;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.JET2Writer;
+import org.eclipse.jet.taglib.AbstractContainerTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.taglib.TagInfo;
+
+/**
+ * Implement &lt;f:bundle&;gt> tag
+ */
+public class BundleTag extends AbstractContainerTag
+{
+
+ private ResourceBundle bundle = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.ContainerTag#doBeforeBody(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, org.eclipse.jet.JET2Writer)
+ */
+ public void doBeforeBody(TagInfo td, JET2Context context, JET2Writer out) throws JET2TagException
+ {
+ final String baseName = getAttribute("basename"); //$NON-NLS-1$
+ bundle = ResourceBundleUtil.loadBundle(context, baseName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.ContainerTag#doAfterBody(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, org.eclipse.jet.JET2Writer)
+ */
+ public void doAfterBody(TagInfo td, JET2Context context, JET2Writer out) throws JET2TagException
+ {
+ // increase changes bundle gets GC'd quickly
+ bundle = null;
+ }
+
+ public final ResourceBundle getBundle()
+ {
+ return bundle;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/MessageTag.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/MessageTag.java
new file mode 100644
index 0000000..d24a5af
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/MessageTag.java
@@ -0,0 +1,110 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: MessageTag.java,v 1.1 2009/03/06 20:53:09 pelder Exp $
+ */
+package org.eclipse.jet.internal.taglib.format;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.jet.BufferedJET2Writer;
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.JET2Writer;
+import org.eclipse.jet.taglib.AbstractContainerTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.taglib.TagInfo;
+import org.eclipse.osgi.util.NLS;
+
+
+/**
+ * @author pelder
+ */
+public class MessageTag extends AbstractContainerTag
+{
+
+ private String key = null;
+
+ private String var = null;
+
+ private ResourceBundle bundle = null;
+
+ private List parameters = new ArrayList(5);
+
+ public void addParam(String value)
+ {
+ parameters.add(value);
+ }
+
+ private Object[] getBindings()
+ {
+ return parameters.toArray();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.ContainerTag#doBeforeBody(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, org.eclipse.jet.JET2Writer)
+ */
+ public void doBeforeBody(TagInfo td, JET2Context context, JET2Writer out) throws JET2TagException
+ {
+ key = getAttribute("key"); //$NON-NLS-1$
+ var = getAttribute("var"); //$NON-NLS-1$
+ bundle = ResourceBundleUtil.findBundle(context, this);
+ }
+
+ public void setBodyContent(JET2Writer bodyContent)
+ {
+ // do not write body content
+ // if no key was specified in an attribute, get if from the content...
+ if (key == null && bodyContent instanceof BufferedJET2Writer)
+ {
+ key = ((BufferedJET2Writer)bodyContent).getContent().trim();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.ContainerTag#doAfterBody(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, org.eclipse.jet.JET2Writer)
+ */
+ public void doAfterBody(TagInfo td, JET2Context context, JET2Writer out) throws JET2TagException
+ {
+ final String formattedMessage;
+ if (key == null)
+ {
+ throw new JET2TagException(Messages.MessageTag_NoKey);
+ }
+ String message;
+ try
+ {
+ message = bundle.getString(key);
+ }
+ catch (MissingResourceException e)
+ {
+ // including the MissingResourceException adds no useful information - don't add it
+ throw new JET2TagException(NLS.bind(Messages.MessageTag_NoMessageForKey, key));
+ }
+ formattedMessage = NLS.bind(message, getBindings());
+
+ if (var != null)
+ {
+ context.setVariable(var, formattedMessage);
+ }
+ else
+ {
+ out.write(formattedMessage);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/Messages.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/Messages.java
new file mode 100644
index 0000000..3249ccc
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/Messages.java
@@ -0,0 +1,47 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: Messages.java,v 1.1 2009/03/06 20:53:09 pelder Exp $
+ */
+package org.eclipse.jet.internal.taglib.format;
+
+
+import org.eclipse.osgi.util.NLS;
+
+
+public class Messages extends NLS
+{
+ private static final String BUNDLE_NAME = "org.eclipse.jet.internal.taglib.format.messages"; //$NON-NLS-1$
+
+ public static String MessageTag_NoKey;
+
+ public static String MessageTag_NoMessageForKey;
+
+ public static String ParamTag_MustBeContainedByMessageTag;
+
+ public static String ParamTag_NoValueSpecified;
+
+ public static String ResourceBundleUtil_UnableToLoadBundle;
+
+ public static String SetLocaleTag_AttributeMustNotBeBlank;
+ static
+ {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/ParamTag.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/ParamTag.java
new file mode 100644
index 0000000..0937a0d
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/ParamTag.java
@@ -0,0 +1,89 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: ParamTag.java,v 1.1 2009/03/06 20:53:09 pelder Exp $
+ */
+package org.eclipse.jet.internal.taglib.format;
+
+import org.eclipse.jet.BufferedJET2Writer;
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.JET2Writer;
+import org.eclipse.jet.taglib.AbstractContainerTag;
+import org.eclipse.jet.taglib.CustomTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.taglib.TagInfo;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Implement &lt;f:param [value="...value..."]&gt; tag
+ */
+public class ParamTag extends AbstractContainerTag
+{
+
+ private String value;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.ContainerTag#doBeforeBody(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, org.eclipse.jet.JET2Writer)
+ */
+ public void doBeforeBody(TagInfo td, JET2Context context, JET2Writer out) throws JET2TagException
+ {
+ value = getAttribute("value"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.AbstractContainerTag#setBodyContent(org.eclipse.jet.JET2Writer)
+ */
+ public void setBodyContent(JET2Writer bodyContent)
+ {
+ // don't write body content...
+ if(value == null && bodyContent instanceof BufferedJET2Writer) {
+ value = ((BufferedJET2Writer)bodyContent).getContent();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.ContainerTag#doAfterBody(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, org.eclipse.jet.JET2Writer)
+ */
+ public void doAfterBody(TagInfo td, JET2Context context, JET2Writer out) throws JET2TagException
+ {
+ final CustomTag parent = getParent();
+ if(!(parent instanceof MessageTag)) {
+ throw new JET2TagException(NLS.bind(Messages.ParamTag_MustBeContainedByMessageTag,
+ getMessageTagName(td)));
+ }
+ if(value == null) {
+ throw new JET2TagException(Messages.ParamTag_NoValueSpecified);
+ }
+
+ MessageTag messageTag = (MessageTag)parent;
+ messageTag.addParam(value);
+ }
+
+ private String getMessageTagName(TagInfo td)
+ {
+ final StringBuffer name = new StringBuffer(20);
+ name.append('<');
+ final String paramTagName = td.getTagName();
+ final int colonPos = paramTagName.indexOf(':');
+ if(colonPos > 0) {
+ // the prefix...
+ name.append(paramTagName.substring(0, colonPos));
+ name.append(':');
+ }
+ name.append("message"); //$NON-NLS-1$
+ name.append('>');
+ return name.toString();
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/ResourceBundleUtil.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/ResourceBundleUtil.java
new file mode 100644
index 0000000..409b53c
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/ResourceBundleUtil.java
@@ -0,0 +1,109 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: ResourceBundleUtil.java,v 1.1 2009/03/06 20:53:09 pelder Exp $
+ */
+package org.eclipse.jet.internal.taglib.format;
+
+
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.taglib.CustomTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.transform.TransformContextExtender;
+import org.eclipse.osgi.util.NLS;
+
+
+/**
+ * Utility class for implementing resource bundle finding for message tags
+ */
+public class ResourceBundleUtil
+{
+ private static final String DEFAULT_BUNDLE_VAR = "org.eclipse.jet.taglib.format.resourceBundle"; //$NON-NLS-1$
+
+ private static final String DEFAULT_LOCALE_VAR = "org.eclipse.jet.taglib.format.locale"; //$NON-NLS-1$
+
+ private static ResourceBundle EMPTY_BUNDLE = new ResourceBundle()
+ {
+
+ protected Object handleGetObject(String key)
+ {
+ return null;
+ }
+
+ public Enumeration getKeys()
+ {
+ return null;
+ }
+ };
+
+ public static ResourceBundle loadBundle(JET2Context context, String baseName)
+ {
+ final ClassLoader classLoader = TransformContextExtender.getInstance(context).getLoader().getClass().getClassLoader();
+ try
+ {
+ return ResourceBundle.getBundle(baseName, getLocale(context), classLoader);
+ }
+ catch (MissingResourceException e)
+ {
+ throw new JET2TagException(NLS.bind(Messages.ResourceBundleUtil_UnableToLoadBundle, baseName), e);
+ }
+ }
+
+ public static ResourceBundle findBundle(JET2Context context, CustomTag currentTag)
+ {
+ for (CustomTag parent = currentTag.getParent(); parent != null; parent = parent.getParent())
+ {
+ if (parent instanceof BundleTag)
+ {
+ return ((BundleTag)parent).getBundle();
+ }
+ }
+ final Object defaultBundle = context.hasVariable(DEFAULT_BUNDLE_VAR) ? context.getVariable(DEFAULT_BUNDLE_VAR) : null;
+
+ return defaultBundle instanceof ResourceBundle ? (ResourceBundle)defaultBundle : EMPTY_BUNDLE;
+ }
+
+ public static void setDefaultBundle(JET2Context context, ResourceBundle bundle)
+ {
+ context.setVariable(DEFAULT_BUNDLE_VAR, bundle);
+ }
+
+ public static void setLocale(JET2Context context, String value, String variant)
+ {
+ value = value.trim();
+ variant = variant.trim();
+
+ final Locale locale;
+
+ final String[] parts = value.split("[_\\-]"); //$NON-NLS-1$
+ final String language = parts.length > 0 ? parts[0] : ""; //$NON-NLS-1$
+ final String country = parts.length > 1 ? parts[1] : ""; //$NON-NLS-1$
+
+ locale = new Locale(language, country, variant);
+
+ context.setVariable(DEFAULT_LOCALE_VAR, locale);
+ }
+
+ private static Locale getLocale(JET2Context context)
+ {
+ final Object locale = context.hasVariable(DEFAULT_LOCALE_VAR) ? context.getVariable(DEFAULT_LOCALE_VAR) : null;
+
+ return locale instanceof Locale ? (Locale)locale : Locale.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/SetBundleTag.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/SetBundleTag.java
new file mode 100644
index 0000000..37eb6d2
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/SetBundleTag.java
@@ -0,0 +1,45 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: SetBundleTag.java,v 1.1 2009/03/06 20:53:09 pelder Exp $
+ */
+package org.eclipse.jet.internal.taglib.format;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.JET2Writer;
+import org.eclipse.jet.taglib.AbstractEmptyTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.taglib.TagInfo;
+
+/**
+ * Implmenent &lt;f:setBundle&gt; tag
+ */
+public class SetBundleTag extends AbstractEmptyTag
+{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.EmptyTag#doAction(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, org.eclipse.jet.JET2Writer)
+ */
+ public void doAction(TagInfo td, JET2Context context, JET2Writer out) throws JET2TagException
+ {
+ final String baseName = getAttribute("basename"); //$NON-NLS-1$
+
+ final ResourceBundle bundle = ResourceBundleUtil.loadBundle(context, baseName);
+
+ ResourceBundleUtil.setDefaultBundle(context, bundle);
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/SetLocaleTag.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/SetLocaleTag.java
new file mode 100644
index 0000000..ab2507b
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/SetLocaleTag.java
@@ -0,0 +1,47 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: SetLocaleTag.java,v 1.1 2009/03/06 20:53:09 pelder Exp $
+ */
+package org.eclipse.jet.internal.taglib.format;
+
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.JET2Writer;
+import org.eclipse.jet.taglib.AbstractEmptyTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.taglib.TagInfo;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Implement &lt;f:setLocale&;gt tag.
+ */
+public class SetLocaleTag extends AbstractEmptyTag
+{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.EmptyTag#doAction(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, org.eclipse.jet.JET2Writer)
+ */
+ public void doAction(TagInfo td, JET2Context context, JET2Writer out) throws JET2TagException
+ {
+ final String value = getAttribute("value"); //$NON-NLS-1$
+ final String variant = getAttribute("variant"); //$NON-NLS-1$
+
+ if(value.trim().length() == 0) {
+ throw new JET2TagException(NLS.bind(Messages.SetLocaleTag_AttributeMustNotBeBlank, "value")); //$NON-NLS-1$
+ }
+
+ ResourceBundleUtil.setLocale(context, value, variant != null ? variant : ""); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java
index f3a5df5..d51e168 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,7 @@ public class TagFactory implements TagInstanceFactory
*/
public TagFactory()
{
- tagOrdinalByName = new HashMap(10);
+ tagOrdinalByName = new HashMap(15);
tagOrdinalByName.put("formatNow",new Integer(1)); //$NON-NLS-1$
tagOrdinalByName.put("indent",new Integer(2)); //$NON-NLS-1$
@@ -44,6 +44,11 @@ public class TagFactory implements TagInstanceFactory
tagOrdinalByName.put("unique",new Integer(8)); //$NON-NLS-1$
tagOrdinalByName.put("uuid",new Integer(9)); //$NON-NLS-1$
tagOrdinalByName.put("xpath",new Integer(10)); //$NON-NLS-1$
+ tagOrdinalByName.put("message",new Integer(11)); //$NON-NLS-1$
+ tagOrdinalByName.put("param",new Integer(12)); //$NON-NLS-1$
+ tagOrdinalByName.put("bundle",new Integer(13)); //$NON-NLS-1$
+ tagOrdinalByName.put("setBundle",new Integer(14)); //$NON-NLS-1$
+ tagOrdinalByName.put("setLocale",new Integer(15)); //$NON-NLS-1$
}
public CustomTag createCustomTag(String name)
@@ -71,6 +76,16 @@ public class TagFactory implements TagInstanceFactory
return new org.eclipse.jet.internal.taglib.format.UuidTag();
case 10: // xpath
return new org.eclipse.jet.internal.taglib.format.XPathTag();
+ case 11: // message
+ return new org.eclipse.jet.internal.taglib.format.MessageTag();
+ case 12: // param
+ return new org.eclipse.jet.internal.taglib.format.ParamTag();
+ case 13: // bundle
+ return new org.eclipse.jet.internal.taglib.format.BundleTag();
+ case 14: // setBundle
+ return new org.eclipse.jet.internal.taglib.format.SetBundleTag();
+ case 15: // setLocale
+ return new org.eclipse.jet.internal.taglib.format.SetLocaleTag();
default:
throw new JET2TagException("Unknown Tag: " + name); //$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/messages.properties b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/messages.properties
new file mode 100644
index 0000000..7757c89
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/messages.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2009 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+#
+# NLS_MESSAGEFORMAT_VAR
+MessageTag_NoKey=No key attribute or body content provided
+MessageTag_NoMessageForKey=No message for for key ''{0}''
+ParamTag_MustBeContainedByMessageTag=This tag must be directedly contained by a {0} tag
+ParamTag_NoValueSpecified=No value specified for parameter
+ResourceBundleUtil_UnableToLoadBundle=Unable to locate resource bundle ''{0}''
+SetLocaleTag_AttributeMustNotBeBlank=Attribute ''{0}'' must have a non-blank value
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java
index a0fefa5..7be175a 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java
index f09e490..8268c98 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jar b/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jar
index dbe8281..036b741 100644
--- a/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jar
+++ b/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jar
Binary files differ
diff --git a/transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs b/transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs
index 303a6b7..dcfd184 100644
--- a/transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs
+++ b/transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,4 @@
-#Sat Apr 26 10:30:38 EDT 2008
+#Fri Mar 06 09:53:21 EST 2009
eclipse.preferences.version=1
encoding//jet2java/org/eclipse/jet/compiled/_jet_tagFactoryjava.java=UTF-8
encoding//templates/tagLibrary/tagFactory.java.jet=UTF-8
diff --git a/transforms/org.eclipse.jet.transforms.taglibdoc/templates/tagLibrary/overview.html.jet b/transforms/org.eclipse.jet.transforms.taglibdoc/templates/tagLibrary/overview.html.jet
index 3e65fd2..159a8f7 100644
--- a/transforms/org.eclipse.jet.transforms.taglibdoc/templates/tagLibrary/overview.html.jet
+++ b/transforms/org.eclipse.jet.transforms.taglibdoc/templates/tagLibrary/overview.html.jet
@@ -25,7 +25,7 @@
<TBODY>
<TR>
<TH colspan="2" align="left">Tag Summary</TH></TR>
-<c:iterate select="$tagLibrary/*[local-name() != 'description']" var="tag" >
+<c:iterate select="sort($tagLibrary/*[local-name() != 'description'], '@name')" var="tag" >
<TR>
<TD width="10%"><A href="<c:get select="$tag/@tagHtmlFile" />">&lt;<c:get select="$tag/@tagQName" />&gt;</A></TD>
<TD><%--<roundtrip>--%><!-- Begin <c:get select="$tag/@name" /> description -->

Back to the top