I'm definitely interested but one question: why not use java.util.ResourceBundle as the
base class? It helps as existing ListResourceBundle and PropertyResourceBundle can 
still be
used.

"Schachter, Michael" wrote:

> Hi,
>
> I'm attempting to develop a fuller form of internationalization for Struts,
> which includes retrieving content from more than something such as a
> ResourceBundle.  The basic idea is that you have a Resource, which is an
> interface that represents anything that has internationalized content.  It
> has a method that looks basically like this:
>
> public byte[] getData(String key, Locale locale, TimeZone timeZone);
>
> Of course, time zone is optional, it would depend on the implementation
> whether or not to use it.
>
> You would define these resources in some xml file, like so:
>
> <resource type="org.apache.struts.i18n.FileSystemResource"
>                name="STATIC_CONTENT">
>     <property name="fileBase">/usr/local/content/static</property>
> </resource>
>
> <resource type="org.apache.struts.i18n.DatabaseResource"
>                name="DB_CONTENT">
>     <!-- possibly specify a bunch of database related properties such
>           as username and password, or tie it into data sources specified
>           in struts-config.xml.  There would also be something specified to
>           where exactly in the data source to pull the content from, this
>           is way up in the air right now
>      -->
> </resource>
>
> Then, you would use a taglib inside of your jsp page to retrieve the
> content:
>
> <%@ page langauge="java" %>
> <%@ taglib uri="/WEB-INF/struts-i18n.tld" prefix="i18n" %>
>
> <h3>This is static internationalized content:</h3>
>
> <i18n:resource key="my.content" name="STATIC_CONTENT" />
>
> <h3>This is internationalized content pulled from a database:</h3>
>
> <i18n:resource key="my.article" name="DB_CONTENT" />
>
> Taking this further, you could create a resource implementation that plugs
> into some kind of commercial content managment system, and so on.
>
> Is there any interest in something like this?  I'm currently in the process
> of developing this idea, and I'd like as much input as possible, not only
> with this, but with internationalization in general.  I attached the
> Resources class, just to illustrate a bit.
>
>  <<Resource.java>>
>
>   ------------------------------------------------------------------------
>                     Name: Resource.java
>    Resource.java    Type: JAVA File 
>(application/x-unknown-content-type-java_auto_file)
>                 Encoding: quoted-printable

Reply via email to