cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neeme Praks" <ne...@one.lv>
Subject RE: ResourceBundles - was [RT] i18n
Date Tue, 20 Jun 2000 19:31:30 GMT

> -----Original Message-----
> From: Mike Engelhart [mailto:mengelhart@earthtrip.com]
> Sent: Monday, June 12, 2000 9:00 PM
> 
> on 6/12/00 11:43 AM, Berin Loritsch at 
> bloritsch@infoplanning.com wrote:
> 
> > <?xml version="1.0"?>
> > <resource xml:lang="en">
> > <group id="error">
> > <value id="500">Internal Server Error</value>
> > <value id="404">Page not found</value>
> > </group>
> > <group id="uri">
> > <value id="addUser">user/add</value>
> > <value id="killUser">user/obliterate</value>
> > </group>
> > <group id="form">
> > <value id="userName">Enter the user's name here</value>
> > </group>
> > </resource>

[snip]

> So in your example, it would be like
> 
> String role = "uri";
> ResourceBundle res = XMLResourceFactory.getResourceBundle(role);
> res.getString("addUser");

I started to implement something like this for myself and came across
following question: would it be possible to nest groups and then address
them using a path?

So, instead of this:

<resources xml:lang="en">
  <group name="forms">
    <resource name="contacts-search-searchfor-desc">find:</resource>
    <resource
name="contacts-search-field-to-search-desc">what:</resource>
    <resource name="contacts-search-from-desc">where:</resource>
    <resource name="contacts-search-from-mycontacts-desc">my
contacts</resource>
    <resource name="contacts-search-from-allmembers-desc">all
members</resource>

    <resource name="contacts-search-field-to-search-all">all</resource>
    <resource name="contacts-search-field-to-search-firstname">first
name</resource>
    <resource name="contacts-search-field-to-search-lastname">last
name</resource>
    <resource
name="contacts-search-field-to-search-phone">phone</resource>
    <resource
name="contacts-search-field-to-search-email">e-mail</resource>

    <resource name="contacts-search-submit">Search</resource>
  </group>
</resources>

something like this:

<resources xml:lang="en">
  <group name="forms">
	  <group name="contacts-search">
		  <group name="desc">
		    <resource name="searchfor">find:</resource>
		    <resource name="field-to-search">what:</resource>
		    <resource name="from">where:</resource>
		    <resource name="from-mycontacts">my
contacts</resource>
		    <resource name="from-allmembers">all
members</resource>
		  </group>
	
		  <group name="input">
			  <group name="field-to-search">
			    <resource name="all">all</resource>
			    <resource name="firstname">first
name</resource>
			    <resource name="lastname">last
name</resource>
			    <resource name="phone">phone</resource>
			    <resource name="email">e-mail</resource>
			  </group>
		    <resource name="submit">Search</resource>
		  </group>
	  </group>
  </group>
</resources>

And then I could address then like:

String role = "forms/contacts-search/desc";
ResourceBundle res = XMLResourceFactory.getResourceBundle(role);
res.getString("searchfor");

Is this reasonable?

Neeme

Mime
View raw message