Author: thomas.heute(a)jboss.com
Date: 2009-12-08 03:42:46 -0500 (Tue, 08 Dec 2009)
New Revision: 971
Modified:
portal/trunk/docs/reference-guide/en/modules/development/XML_Resource_Bundles.xml
Log:
Reformat
Modified:
portal/trunk/docs/reference-guide/en/modules/development/XML_Resource_Bundles.xml
===================================================================
---
portal/trunk/docs/reference-guide/en/modules/development/XML_Resource_Bundles.xml 2009-12-08
07:15:13 UTC (rev 970)
+++
portal/trunk/docs/reference-guide/en/modules/development/XML_Resource_Bundles.xml 2009-12-08
08:42:46 UTC (rev 971)
@@ -2,65 +2,67 @@
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<section id="sect-Reference_Guide-XML_Resources_Bundles">
- <!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-
- --><title>XML Resources Bundles</title>
+ <title>XML Resources Bundles</title>
<section id="sect-Reference_Guide-XML_Resources_Bundles-Motivation">
<title>Motivation</title>
<para>
- Usually resource bundles are stored in property files however as property files are
plain files it raise issues with the encoding of the file. The XML resource bundle format
has been developped to provide an alternative to property files.
+ Usually resource bundles are stored in property files however as
+ property files are plain files it raise issues with the encoding of
+ the file. The XML resource bundle format has been developed to
+ provide an alternative to property files.
</para>
<itemizedlist>
<listitem>
<para>
- The XML format declares the encoding of the file in the XML declaration which avoids
to use the native2ascii program and mess with encoding
+ The XML format declares the encoding of the file in the XML
+ declaration which avoids to use the native2ascii program and mess
+ with encoding.
</para>
</listitem>
<listitem>
<para>
- Property files use the ISO 8859-1 which does not cover the full unicode charset and
language such as arab would not be supported natively and require the use of escaping,
leading the files to be barely maintainable
+ Property files use the ISO 8859-1 which does not cover the
+ full unicode charset and language such as Arabic would not be
+ supported natively and require the use of escaping, leading the
+ files to be barely maintainable.
</para>
</listitem>
<listitem>
<para>
- Tooling support for XML files is better than the tooling for Java property files and
usually the XML editor cope very well with the file encoding.
+ Tooling support for XML files is better than the tooling for
+ Java property files and usually the XML editor cope very well with
+ the file encoding.
</para>
</listitem>
</itemizedlist>
</section>
-
+
<section
id="sect-Reference_Guide-XML_Resources_Bundles-Portal_support">
<title>Portal support</title>
<para>
- In order to be loaded by the portal at runtime (actually the resource bundle service),
the name of the file must be the same as a property file but instead of ending with the
<emphasis role="bold">.properties</emphasis> suffix, it ends with
the <emphasis role="bold">.xml</emphasis> suffix. For instance
<emphasis role="bold"> AccountPortlet <emphasis
role="bold">ar.xml</emphasis> instead of
<emphasis>AccountPortlet</emphasis> ar.properties </emphasis> .
+ In order to be loaded by the portal at runtime (actually the resource
+ bundle service), the name of the file must be the same as a property
+ file but instead of ending with the
+ <emphasis role="bold">.properties</emphasis>
+ suffix, it ends with the
+ <emphasis role="bold">.xml</emphasis>
+ suffix. For instance
+ <emphasis role="bold">
+ AccountPortlet_ar.xml</emphasis>
+ instead of
+ <emphasis role="bold">AccountPortlet_ar.properties</emphasis>.
</para>
</section>
-
+
<section id="sect-Reference_Guide-XML_Resources_Bundles-XML_format">
<title>XML format</title>
<para>
- The XML format is very simple and has been developed based on the DRY (Don't
Repeat Yourself) principle. Usually resource bundle keys are hierarchically defined and we
can leverage the hierarchic nature of the XML for that purpose. Here is an example of
turning a property file into an XML resource bundle file:
+ The XML format is very simple and has been developed based on
+ the DRY (Don't Repeat Yourself) principle. Usually resource bundle
+ keys are hierarchically defined and we can leverage the hierarchic
+ nature of the XML for that purpose. Here is an example of turning a
+ property file into an XML resource bundle file:
</para>
- <para>
- <STYLE type="text/css"> .code {width: 97%}
</STYLE>
- </para>
<programlisting>UIAccountForm.tab.label.AccountInputSet = ...
UIAccountForm.tab.label.UIUserProfileInputSet = ...
@@ -73,29 +75,29 @@
UIAccountForm.action.Reset= ...
</programlisting>
-<programlisting><?xml version="1.0"
encoding="UTF-8"?>
-<bundle>
- <UIAccountForm>
- <tab>
- <label>
- <AccountInputSet>...</AccountInputSet>
- <UIUserProfileInputSet>...</UIUserProfileInputSet>
- </label>
- </tab>
- <label>
- <Profile>...</Profile>
- <HomeInfo>...</HomeInfo>
- <BusinessInfo>...</BusinessInfo>
- <password>...</password>
- <Confirmpassword>...</Confirmpassword>
- <email>...</email>
- </label>
- <action>
- <Reset>...</Reset>
- </action>
- </UIAccountForm>
-</bundle>
-</programlisting>
+<programlisting role="XML"><![CDATA[<?xml version="1.0"
encoding="UTF-8"?>
+<bundle>
+ <UIAccountForm>
+ <tab>
+ <label>
+ <AccountInputSet>...</AccountInputSet>
+ <UIUserProfileInputSet>...</UIUserProfileInputSet>
+ </label>
+ </tab>
+ <label>
+ <Profile>...</Profile>
+ <HomeInfo>...</HomeInfo>
+ <BusinessInfo>...</BusinessInfo>
+ <password>...</password>
+ <Confirmpassword>...</Confirmpassword>
+ <email>...</email>
+ </label>
+ <action>
+ <Reset>...</Reset>
+ </action>
+ </UIAccountForm>
+</bundle>
+]]></programlisting>
</section>
</section>