dflorey 2004/12/18 07:39:08
Modified: i18n/xdocs quickstart.xml
Added: i18n/xdocs/images i18n-logo-white.psd
Log:
Added support for pluggable MessageProviders and added
ResourceBundleMessageProvider
to enable migration from resource bundle based applications to i18n.
Revision Changes Path
1.2 +43 -3 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- quickstart.xml 5 Oct 2004 17:47:55 -0000 1.1
+++ quickstart.xml 18 Dec 2004 15:39:08 -0000 1.2
@@ -12,10 +12,50 @@
<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 xml-importer-jar for reading
+<p>To get started you need at least the jar of this component and the
dependent xmlio-jar for reading
xml documents in your classpath.</p>
</section>
-<section name="Defining the messages">
+<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>
+</section>
+<section name="NEW: ResourceBundle based message provider added">
+ <p>A new message provider made it into this component: The
ResourceBundleMessageProvider.
+ 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>
+<p>As you know you'll need two files, each containing the messages for a
specific locale. This one might be
+ the default one calld myMessages.properties:</p>
+ <source>
+welcome.text=Welcome
+usage.title=Usage
+usage.text=The application requires the following parameters:
+validationFailed.title=Parameter {0} invalid
+validationFailed.text=The given value of the parameter {0} is invalid
+validationFailed.summary=Value of parameter {0} invalid
+validationFailed.details=The given value {1} of parameter {0} is invalid.
+</source>
+<p>The following one would contain the corresponding german translations in
a file called myMessages_de.properties:</p>
+ <source>
+welcome.text=Willkommen
+usage.title=Benutzung
+usage.text=Die folgenden Parameter werden erwartet:
+validationFailed.title=Parametervalidierung fehlgeschlagen.
+validationFailed.text=Die Validierung des Parameters {0} ist fehlgeschlagen.
+validationFailed.summary=Validierung des Parameters {0} fehlgeschlagen.
+validationFailed.details=Der Wert {1} des Parameters {0} ist ungültig.
+</source>
+</section>
+<section name="Defining the messages in an XML file">
+ <p>Using XML based files has many advantages:</p>
+ <ul>
+ <li>You can use the XML-editor of your choice to get assistance
by typing the messages</li>
+ <li>All entries that belong together are grouped into a single
XML element</li>
+ <li>All languages reside in a single file, so it is simpler to
add a new language (matter of taste?)</li>
+ <li>As the whole file gets parsed at initialization time, the
localization is much faster</li>
+ </ul>
<p>You have to initialize the message manager with an input stream
giving access to
the xml document containing the localized messages.</p>
<source>
@@ -70,7 +110,7 @@
...
try {
FileInputStream inputStream = new FileInputStream("myMessages.xml");
- MessageManager.install("myMessages", inputStream);
+ XMLMessageProvider.install("myMessages", inputStream);
} catch ( FileNotFoundException e ) {
// handle exception
}
1.1
jakarta-commons-sandbox/i18n/xdocs/images/i18n-logo-white.psd
<<Binary file>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]