[jboss-cvs] jboss-seam/doc/reference/en/modules ...
Gavin King
gavin.king at jboss.com
Tue Oct 31 00:06:43 EST 2006
User: gavin
Date: 06/10/31 00:06:43
Modified: doc/reference/en/modules framework.xml i18n.xml
Log:
new messages stuff
Revision Changes Path
1.4 +15 -0 jboss-seam/doc/reference/en/modules/framework.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: framework.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/framework.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- framework.xml 19 Oct 2006 20:03:22 -0000 1.3
+++ framework.xml 31 Oct 2006 05:06:43 -0000 1.4
@@ -338,6 +338,21 @@
}]]></programlisting>
<para>
+ But the best way to specify the messages is to put them in a resource
+ bundle known to Seam (the bundle named <literal>messages</literal>,
+ by default).
+ </para>
+
+ <programlisting><![CDATA[Person_created=New person #{person.firstName} #{person.lastName} created
+Person_deleted=Person #{person.firstName} #{person.lastName} deleted
+Person_updated=Person #{person.firstName} #{person.lastName} updated]]></programlisting>
+
+ <para>
+ This enables internationalization, and keeps your code and configuration clean of
+ presentation concerns.
+ </para>
+
+ <para>
The final step is to add validation functionality to the page, using
<literal><s:validateAll></literal> and <literal><s:decorate></literal>,
but I'll leave that for you to figure out.
1.10 +28 -1 jboss-seam/doc/reference/en/modules/i18n.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i18n.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/i18n.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- i18n.xml 16 Oct 2006 11:23:14 -0000 1.9
+++ i18n.xml 31 Oct 2006 05:06:43 -0000 1.10
@@ -88,6 +88,8 @@
display templated labels with embedded EL expressions.
</para>
+ <section>
+ <title>Defining labels</title>
<para>
Each login session has an associated instance of
<literal>java.util.ResourceBundle</literal> (available to the
@@ -131,7 +133,31 @@
</component>]]></programlisting>
<para>
- If you define your labels in this special resource bundle, you'll
+ If you want to define a message just for a particular page, you
+ can specify it in a resource bundle with the same name as the
+ JSF view id, with the leading <literal>/</literal> and trailing
+ file extension removed. So we could put our message in
+ <literal>welcome/hello_en.properties</literal> if we only needed
+ to display the message on <literal>/welcome/hello.jsp</literal>.
+ </para>
+
+ <para>
+ You can even specify an explicit bundle name in <literal>pages.xml</literal>:
+ </para>
+
+ <programlisting><![CDATA[<page view-id="/welcome/hello.jsp" bundle="HelloMessages"/>]]></programlisting>
+
+ <para>
+ Then we could use messages defined in <literal>HelloMessages.properties</literal>
+ on <literal>/welcome/hello.jsp</literal>.
+ </para>
+ </section>
+
+ <section>
+ <title>Displaying labels</title>
+
+ <para>
+ If you define your labels using the Seam resource bundle, you'll
be able to use them without having to type <literal><f:loadBundle ... /></literal>
on every page. Instead, you can simply type:
</para>
@@ -185,6 +211,7 @@
</para>
</section>
+ </section>
<section>
<title>Timezones</title>
More information about the jboss-cvs-commits
mailing list