You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jim Menard <ji...@io.com> on 2004/01/02 17:35:02 UTC
TapestryStrings resource bundle
I'm looking for a place to put localizable strings used by non-Tapestry
sections of code. I found Tapestry.getMessage(), which calls format(),
which "Gets a string from the TapestryStrings resource bundle".
Is that a good place to put application strings, or should I create my
own properties file? The reason that I think it would be good to use
Tapestry.getMessage() instead of a separate properties file is that
Tapestry is already holding and managing the locale. If I use my own
properties file, I'll just have to ask Tapestry for the locale anyway.
Where does/should the TapestryStrings resource bundle live? The code
uses
_strings =
ResourceBundle.getBundle("org.apache.tapestry.TapestryStrings");
Does this mean that I should create the file
.../WEB-INF/classes/org/apache/tapestry/TapestryString.properties
As always, thank you for your help.
Jim
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm/
"Alas! The onion you are eating is someone else's waterlily."
-- A fortune cookie fortune
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: TapestryStrings resource bundle
Posted by Jim Menard <ji...@io.com>.
> I would not recommend you use TapestryStrings if it is for
> non-Tapestry (or even if it was for Tapestry) parts of your
> application.
Thanks to Erik and Howard for your explanation.
> Perhaps it would be worthwhile for you to invent your own resource
> abstraction that your non-Tapestry uses and write an adapter that
> pulls from Tapestry's resource handling?
I already have one from another project, actually. The only headache
will be the locale; since it can be different for every page (well,
every session) I now need to obtain it from within a non-Tapestry
component and pass it along.
Jim
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm/
"Sell a man a fish, he eats for a day. Teach a man to fish, you've lost
a customer." -- hartley_h, in comp.lang.perl.misc
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: TapestryStrings resource bundle
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
I would not recommend you use TapestryStrings if it is for non-Tapestry
(or even if it was for Tapestry) parts of your application.
Perhaps it would be worthwhile for you to invent your own resource
abstraction that your non-Tapestry uses and write an adapter that pulls
from Tapestry's resource handling?
Erik
On Jan 2, 2004, at 11:35 AM, Jim Menard wrote:
> I'm looking for a place to put localizable strings used by
> non-Tapestry sections of code. I found Tapestry.getMessage(), which
> calls format(), which "Gets a string from the TapestryStrings resource
> bundle".
>
> Is that a good place to put application strings, or should I create my
> own properties file? The reason that I think it would be good to use
> Tapestry.getMessage() instead of a separate properties file is that
> Tapestry is already holding and managing the locale. If I use my own
> properties file, I'll just have to ask Tapestry for the locale anyway.
>
> Where does/should the TapestryStrings resource bundle live? The code
> uses
>
> _strings =
> ResourceBundle.getBundle("org.apache.tapestry.TapestryStrings");
>
> Does this mean that I should create the file
>
> .../WEB-INF/classes/org/apache/tapestry/TapestryString.properties
>
> As always, thank you for your help.
>
> Jim
> --
> Jim Menard, jimm@io.com, http://www.io.com/~jimm/
> "Alas! The onion you are eating is someone else's waterlily."
> -- A fortune cookie fortune
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: TapestryStrings resource bundle
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Nope; there already IS a TapestryStrings.properties file which you shouldn't mess with. All the
Tapestry code uses Tapestry.getMessage() and related for all exception and logging messages. You can
build something similar for your own app, perhaps.
You can build something similar. In addtion, pages and components can have their own set of
localized strings.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com
> -----Original Message-----
> From: Jim Menard [mailto:jimm@io.com]
> Sent: Friday, January 02, 2004 11:35 AM
> To: Tapestry users
> Subject: TapestryStrings resource bundle
>
>
> I'm looking for a place to put localizable strings used by
> non-Tapestry
> sections of code. I found Tapestry.getMessage(), which calls
> format(),
> which "Gets a string from the TapestryStrings resource bundle".
>
> Is that a good place to put application strings, or should I
> create my
> own properties file? The reason that I think it would be good to use
> Tapestry.getMessage() instead of a separate properties file is that
> Tapestry is already holding and managing the locale. If I use my own
> properties file, I'll just have to ask Tapestry for the locale anyway.
>
> Where does/should the TapestryStrings resource bundle live? The code
> uses
>
> _strings =
> ResourceBundle.getBundle("org.apache.tapestry.TapestryStrings");
>
> Does this mean that I should create the file
>
> .../WEB-INF/classes/org/apache/tapestry/TapestryString.properties
>
> As always, thank you for your help.
>
> Jim
> --
> Jim Menard, jimm@io.com, http://www.io.com/~jimm/
> "Alas! The onion you are eating is someone else's waterlily."
> -- A fortune cookie fortune
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org