Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 40059 invoked from network); 28 Nov 2005 20:43:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Nov 2005 20:43:47 -0000 Received: (qmail 54430 invoked by uid 500); 28 Nov 2005 20:43:44 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 54266 invoked by uid 500); 28 Nov 2005 20:43:44 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 54255 invoked by uid 99); 28 Nov 2005 20:43:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Nov 2005 12:43:43 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [217.160.108.75] (HELO a15181680.alturo-server.de) (217.160.108.75) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Nov 2005 12:45:13 -0800 Received: from p54a1bac0.dip0.t-ipconnect.de ([84.161.186.192] helo=localhost) by a15181680.alturo-server.de with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.54) id 1EgpqI-0002NN-M8 for commons-dev@jakarta.apache.org; Mon, 28 Nov 2005 21:43:18 +0100 Received: from chris by localhost with local (Exim 4.54) id 1EgpqA-0005yq-5p for commons-dev@jakarta.apache.org; Mon, 28 Nov 2005 21:43:10 +0100 Subject: Re: [resources] 1.0.0 Release Candidate 1 From: Christian Meder To: Jakarta Commons Developers List In-Reply-To: <55afdc850511271900y137eb016s414e88be3c070385@mail.gmail.com> References: <000d01c5f38a$91715fd0$0400a8c0@DELL1800> <55afdc850511271150tf372cb5j73f4b98d56bf5b45@mail.gmail.com> <55afdc850511271900y137eb016s414e88be3c070385@mail.gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 28 Nov 2005 21:43:09 +0100 Message-Id: <1133210589.12252.53.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Mon, 2005-11-28 at 03:00 +0000, Niall Pemberton wrote: > On 11/28/05, Craig McClanahan wrote: > > On 11/27/05, Niall Pemberton wrote: > > > > > > A couple of questions I had on the resources API: > > > > > > 1) I was wondering why TimeZone is include in the Resources's content > > > read methods? Is there a use case, for example, for giving west coast > > > Americans a different message to east coast? > > > > > > Some of the format options for displaying times take a time zone parameter > > (so that it can be included in the emitted string). Simply pass null if it > > doesn't matter to you. > > I don't see any valid formats specified in java.text.MessageFormat > that take a TimeZone. Thats slightly irrelevant though since AFAIK > Commons Resources doesn't deal anywhere with message formats. My > understanding that happends after the resource has been retrieved, > something like.... > > String msgResource = myResources.getString("foo.key", locale, null); > MessageFormat msgFormat = new MessageFormat(msgResource); > msgFormat.setLocale(locale); > String message = msgFormat.format(args); > > Have I got the wrong end of the stick on this? Struts MessageResources > does do the MessageFormat bit, but Commons Resources doesn't. Actually I just nuked my reply (still stuck on my laptop) which reiterated my concern from my mail a couple of days that MessageResources and the MessageFormat stuff is missing like you did. But I guess I found it: it's in Messages. So I guess it should be more along the line: Messages myMsgResources = new Messages(myResources); String message = myMsgResources.getMessage(locale, "foo.key", args); But there are some things which should get improved wrt Messages: * include all parametric replacement options like in Struts MessageResources (not only arg0 and [] args) * the order of locale and key is reversed compared to Resources, it's (locale, key); Resources is (key, locale) * MessageFormat isn't cached as it is in Struts MessageResources * setLocale isn't called on the used MessageFormat instances * the TimeZone parameter isn't used like in the rest of commons-resources If nobody objects I'll whip up patches for the above points. Greetings, Christian -- Christian Meder, email: chris@absolutegiganten.org The Way-Seeking Mind of a tenzo is actualized by rolling up your sleeves. (Eihei Dogen Zenji) --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org