dflorey 2004/12/18 07:56:28
Modified: i18n/xdocs quickstart.xml
Log:
Added docs for new ResourceBundleMessageProvider
Revision Changes Path
1.3 +18 -4 jakarta-commons-sandbox/i18n/xdocs/quickstart.xml
Index: quickstart.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/i18n/xdocs/quickstart.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- quickstart.xml 18 Dec 2004 15:39:08 -0000 1.2
+++ quickstart.xml 18 Dec 2004 15:56:28 -0000 1.3
@@ -12,17 +12,17 @@
<section name="Getting started">
<p>In order to get an impression of how this component works, we will start
with an
example showing the capabilities of this package.</p>
-<p>To get started you need at least the jar of this component and the
dependent xmlio-jar for reading
+<p>To get started you need at least the jar of this component and the
dependent <code>xmlio-x.x.jar</code> for reading
xml documents in your classpath.</p>
</section>
<section name="NEW: Pluggable message providers">
<p>Since version 0.3 of this component you can add your own custom message
providers.</p>
<p>This is a big plus if you already have your localized messages in a
database for example.
You do not have to convert them into the supported XML or
property-based format, but you
- can write a simple MessageProvider by implementing a single method and
plug it in.</p>
+ can write a simple <code>MessageProvider</code> by implementing a
single method and plug it in.</p>
</section>
<section name="NEW: ResourceBundle based message provider added">
- <p>A new message provider made it into this component: The
ResourceBundleMessageProvider.
+ <p>A new message provider made it into this component: The
<code>ResourceBundleMessageProvider</code>.
This one enables you to keep your property files that may
contain localized messages.</p>
<p>You can group entries messages by adding the key at the end of the
existing message key. The
following example shows how a property file should look like to
work as the following XML example:</p>
@@ -105,7 +105,9 @@
</section>
<section name="Initializing the messages">
<p>Now that we created a file containing the desired messages, we want to
make use of them.
-To do so we have to initialize the <code>MessageManager</code> with these
messages.</p>
+To do so we have to initialize the <code>MessageProvider</code> with these
messages.</p>
+ <p>Initializing messages depends on the <code>MessageProvider</code>
that you are using. In case of
+ an <code>XMLMessageProvider</code> initialization looks like
this:</p>
<source>
...
try {
@@ -122,6 +124,18 @@
where you want probably load messages from you .war archive. So an
input stream is much
more flexible, even if it is a little bit more unconvenient than using
a file name in our use case.</p>
+<p>In case of the brand new <code>ResourceBundleMessageProvider</code>
initialization looks even simpler:</p>
+<source>
+...
+try {
+ ResourceBundleMessageProvider.install("myMessages");
+} catch ( FileNotFoundException e ) {
+ // handle exception
+}
+...
+</source>
+<p>It's this simple, because the <code>ResourceBundleMessageProvider</code>
uses the build-in features of Java to locate
+ and load the appropriate property files or resource bundle classes.</p>
</section>
<section name="Using message bundles">
<p>Now we are ready to go! First of all we want to print out a simple
localized welcome
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]