package com.smartgwt.client.docs;
/**
* <h3>DataSource Localization</h3>
*
* DataSources which are declared in XML (.ds.xml files) and are read by the Smart GWT
* server, which are normally loaded
* by the <code>DataSourceLoader</code> servlet, can instead be
* loaded and interpreted as .jsp files via the technique described below. This allows JSTL
* and other JSP tags to be used to internationalize the titles and validation error messages
* in XML DataSources.
* <P>
* For example, given the following DataSource located in /shared/ds/supplyItem.ds.xml:
* <pre>
* <DataSource>
* <fields>
* <field name="itemName">
* <title>Item Name</title>
* <validators>
* <Validator type="lengthRange" max="40">
* <errorMessage>Must be 40 characters or less.</errorMessage>
* </Validator>
* </validators>
* </field>
* </fields>
* </DataSource>
* </pre>
* To localize the title and validator error string of the <code>itemName</code> field
* via standard JSTL tags, first add the following to your web.xml to allow DataSource files to
* be interpreted as JSPs:
* <pre>
* <jsp-config>
* <jsp-property-group>
* <url-pattern>/shared/ds/*</url-pattern>
* </jsp-property-group>
* </jsp-config>
* </pre>
* Next change the DataSource definition as follows:
* <pre>
* <!--
* <%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
* -->
* <DataSource xmlns:fmt="urn:jsptld:/WEB-INF/fmt.tld">
* <fields>
* <field name="itemName">
* <title><fmt:message key="itemTitle"/></title>
* <validators>
* <Validator type="lengthRange" max="40">
* <errorMessage><fmt:message key="itemLengthRangeValidator"/></errorMessage>
* </Validator>
* </validators>
* </field>
* </fields>
* </DataSource>
* </pre>
* Note that the XML comment around the taglib declaration is intentional. It is there to make
* sure the JSP parser sees the tag library declaration, while the file remains valid XML.
* If you need to use multiple JSP tag libraries to achieve your goals, simply add additional
* taglib declarations inside the XML comment and be sure to register the tag namespace in the
* DataSource tag via <code>xmlns:tagName</code> as done above for the <code>fmt</code>
* namespace.
*
*
* Instead of using the <code>DataSourceLoader</code> servlet to load this DataSource, you
* should create a JSP that uses SmartGWT Server's XML conversion tag to return Javascript
* DataSource definitions to the browser (exactly like <code>DataSourceLoader</code> does):
* Using this example as a base, just add a <code>jsp:include</code> line for each of your
* DataSources that requires i18n support:
* <pre>
* <%@ taglib uri="/WEB-INF/iscTaglib.xml" prefix="isomorphic" %>
* <isomorphic:XML>
* <jsp:include page="/shared/ds/supplyItem.ds.xml"></jsp:include>
* <jsp:include page="/shared/ds/supplyCategory.ds.xml"></jsp:include>
* </isomorphic:XML>
* </pre>
* You then refer to this JSP in a <code><script src=...></code> tag, in place of
* the <code>DataSourceLoader</code> reference. For example, if you named the file
* "dataSourceLoader.jsp":
* <p><code>
* <script src=dataSourceLoader.jsp></script>
* </code><p>
*
* This makes it possible to internationalize field titles as well as validation error messages
* for built-in validators. To internationalize custom server-side validation errors, simply
* provide internationalized strings when calling <code>DSResponse.setErrorReport()</code> to
* report validation errors (see the JavaDoc for that documentation).
*/
public interface DataSourceLocalization {
}