You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Gerzabek <mi...@gmx.net> on 2008/04/10 11:10:36 UTC

T5 property file for enum

Hi,

I love the new enum support for automagic selects. Thanks for that Howard!

I have shifted many constants to enums. The arising question is how to 
prepare Messages to those enums in most convenient way.

At the time I use one property file per Page. When I have an enum 
display a select on that Page I customize labels for the distinct enum 
values in that property file. Having the same enum on different Pages I 
ran into the usual copy'n paste practice.

Is there a way to customize labels for enums in only one file per locale 
so that those properties get read whenever the enum is used on a Page?

What are your best practices?

Regards,
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 property file for enum

Posted by Michael Gerzabek <mi...@gmx.net>.
Great, Thanks!

Robert Zeigler schrieb:
> You can put the labels in your application's global properties file.
> See: 
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/localization.html 
>
> In particular, note the section on the Application Message Catalog:
>
> "Application Message Catalog
>
> If the file WEB-INF/AppName.properties exists in the context, it will 
> be used as an application-wide message catalog. The AppName is derived 
> from the name of the filter inside the web.xml file. The search for 
> the file is case sensitive. The properties file may be localized.
>
> Individual pages and components can override the values defined in 
> this message catalog."
>
>
> Robert
>
> On Apr 10, 2008, at 4/104:10 AM , Michael Gerzabek wrote:
>> Hi,
>>
>> I love the new enum support for automagic selects. Thanks for that 
>> Howard!
>>
>> I have shifted many constants to enums. The arising question is how 
>> to prepare Messages to those enums in most convenient way.
>>
>> At the time I use one property file per Page. When I have an enum 
>> display a select on that Page I customize labels for the distinct 
>> enum values in that property file. Having the same enum on different 
>> Pages I ran into the usual copy'n paste practice.
>>
>> Is there a way to customize labels for enums in only one file per 
>> locale so that those properties get read whenever the enum is used on 
>> a Page?
>>
>> What are your best practices?
>>
>> Regards,
>> Michael
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 property file for enum

Posted by Robert Zeigler <ro...@scazdl.org>.
You can put the labels in your application's global properties file.
See: http://tapestry.apache.org/tapestry5/tapestry-core/guide/localization.html
In particular, note the section on the Application Message Catalog:

"Application Message Catalog

If the file WEB-INF/AppName.properties exists in the context, it will  
be used as an application-wide message catalog. The AppName is derived  
from the name of the filter inside the web.xml file. The search for  
the file is case sensitive. The properties file may be localized.

Individual pages and components can override the values defined in  
this message catalog."


Robert

On Apr 10, 2008, at 4/104:10 AM , Michael Gerzabek wrote:
> Hi,
>
> I love the new enum support for automagic selects. Thanks for that  
> Howard!
>
> I have shifted many constants to enums. The arising question is how  
> to prepare Messages to those enums in most convenient way.
>
> At the time I use one property file per Page. When I have an enum  
> display a select on that Page I customize labels for the distinct  
> enum values in that property file. Having the same enum on different  
> Pages I ran into the usual copy'n paste practice.
>
> Is there a way to customize labels for enums in only one file per  
> locale so that those properties get read whenever the enum is used  
> on a Page?
>
> What are your best practices?
>
> Regards,
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 property file for enum

Posted by Thiago HP <th...@gmail.com>.
On Thu, Apr 10, 2008 at 6:10 AM, Michael Gerzabek
<mi...@gmx.net> wrote:
>  Is there a way to customize labels for enums in only one file per locale so
> that those properties get read whenever the enum is used on a Page?
?

In my humble opinion, the best approach is to put all the messages in
WEB-INF/app.properties (thus avoiding copy and paste and promoting
message standardization across the whole application) and to only use
a properties file for pages that need to override some messages.

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org