You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Cyrille37 <cy...@gmail.com> on 2006/12/18 22:27:41 UTC

Localized validation messages

Hello,

I was coming mad when trying to localize my validation messages.
After some search I've found a thread in that list which explain that:

[quote] 
That's because Tapestry looks for "username-not-unique" in the properties
file bundeled with Tapestry. To override it, your 
ValidationStrings.properties should have this path
{CLASS_PATH_ROOT}/org/apache/tapestry/valid/ValidationStrings.properties.
To do that:
create the package /org/apache/tapestry/valid/ under your source folder 
and place your custom ValidationStrings.properties there.
[/quote]

Here there another way to localize validation messages ?
I hope there is a cleanest method.

How do you manage that case ?
Thanks
Cyrille

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


Re: Localized validation messages

Posted by cyrille37 <cy...@gmail.com>.


Norbert Sándor wrote:
> 
> I think you have to use this "dirty" solution.
> 

Ok, I'll use another way : injecting the message into the Validator

<bean name="uploadFileValidator"
class="tap03.ui.web.validators.DocumentsUploadFileValidator" >
 <set name="messageUnauthorizedContenttype"
value="message:documents.fileupload.unauthorizedcontenttype" />
</bean>

-- 
View this message in context: http://www.nabble.com/Localized-validation-messages-tf2842493.html#a7938551
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Localized validation messages

Posted by Norbert Sándor <de...@erinors.com>.
I think you have to use this "dirty" solution.
There is an issue about this problem, it is currently scheduled for 
4.1.2 (http://issues.apache.org/jira/browse/TAPESTRY-698).

Regards:
Norbi

Cyrille37 írta:
> Hello,
>
> I was coming mad when trying to localize my validation messages.
> After some search I've found a thread in that list which explain that:
>
> [quote] That's because Tapestry looks for "username-not-unique" in the 
> properties
> file bundeled with Tapestry. To override it, your 
> ValidationStrings.properties should have this path
> {CLASS_PATH_ROOT}/org/apache/tapestry/valid/ValidationStrings.properties.
> To do that:
> create the package /org/apache/tapestry/valid/ under your source 
> folder and place your custom ValidationStrings.properties there.
> [/quote]
>
> Here there another way to localize validation messages ?
> I hope there is a cleanest method.
>
> How do you manage that case ?
> Thanks
> Cyrille
>
> ---------------------------------------------------------------------
> 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: Localized validation messages

Posted by andyhot <an...@di.uoa.gr>.
http://tapestry.apache.org/tapestry4.1/usersguide/localization.html

See the namespace message catalogs


Marilen Corciovei wrote:
> On Tue, 2006-12-19 at 11:22 +0100, Cyrille37 wrote:
>
>   
>> Marilen Corciovei a écrit :
>>     
>>> In fact you don't need to overwrite the ValidationStrings.properties
>>> which is supposed to be the default one. You just need to have the
>>> ValidationStrings_{locale_code}.properties. In order to add french
>>> validation to Tapestry I created a Tapestry-french-validation.jar in the
>>> lib with the following content:
>>>
>>> jar tvf Tapestry-french-validation.jar 
>>>
>>>      0 Sun May 01 14:06:18 EEST 2005 META-INF/
>>>    106 Sun May 01 14:06:16 EEST 2005 META-INF/MANIFEST.MF
>>>      0 Sun May 01 14:06:18 EEST 2005 org/
>>>      0 Sun May 01 14:06:18 EEST 2005 org/apache/
>>>      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/
>>>      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/valid/
>>>    902 Sun May 01 14:06:18 EEST 2005
>>> org/apache/tapestry/valid/ValidationStrings_fr.properties
>>>   
>>>       
>> Hello,
>> Thank you Len.
>>
>> That is great for default validation messages translation, but not for 
>> 'custom' messages, isn't it ?
>>     
>
> You are right. For custom messages either for page/component
> translations or other messages in the application I know only of 2
> mechanisms:
>
> - per page/component messages stored in the
> page/component_{locale}.properties which can then be accessed using the
> message: syntax, span key = in the template or getMessage in the code. I
> do not like this too much because you end up having a lot of files
> - global using the standard java MessageStore mechanism but then you end
> up with very large files and it's totaly separated from tapestry
> mechanisms.
>
> I think this choice depends on you mechanism for editing the ressource
> files later. I found some tools: http://freshmeat.net/projects/jinto/ or
> http://freshmeat.net/projects/prbeditor/ but this is a completely
> different question
>
> Len
> www.len.ro
>
>
>   
>> Cyrille.
>>     
>>> Hope it helps,
>>> Len
>>>
>>> On Mon, 2006-12-18 at 22:27 +0100, Cyrille37 wrote:
>>>
>>>   
>>>       
>>>> Hello,
>>>>
>>>> I was coming mad when trying to localize my validation messages.
>>>> After some search I've found a thread in that list which explain that:
>>>>
>>>> [quote] 
>>>> That's because Tapestry looks for "username-not-unique" in the properties
>>>> file bundeled with Tapestry. To override it, your 
>>>> ValidationStrings.properties should have this path
>>>> {CLASS_PATH_ROOT}/org/apache/tapestry/valid/ValidationStrings.properties.
>>>> To do that:
>>>> create the package /org/apache/tapestry/valid/ under your source folder 
>>>> and place your custom ValidationStrings.properties there.
>>>> [/quote]
>>>>
>>>> Here there another way to localize validation messages ?
>>>> I hope there is a cleanest method.
>>>>
>>>> How do you manage that case ?
>>>> Thanks
>>>> Cyrille
>>>>
>>>>     
>>>>         
>>
>> ---------------------------------------------------------------------
>> 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: Localized validation messages

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
On Tue, 2006-12-19 at 11:22 +0100, Cyrille37 wrote:

> Marilen Corciovei a écrit :
> > In fact you don't need to overwrite the ValidationStrings.properties
> > which is supposed to be the default one. You just need to have the
> > ValidationStrings_{locale_code}.properties. In order to add french
> > validation to Tapestry I created a Tapestry-french-validation.jar in the
> > lib with the following content:
> >
> > jar tvf Tapestry-french-validation.jar 
> >
> >      0 Sun May 01 14:06:18 EEST 2005 META-INF/
> >    106 Sun May 01 14:06:16 EEST 2005 META-INF/MANIFEST.MF
> >      0 Sun May 01 14:06:18 EEST 2005 org/
> >      0 Sun May 01 14:06:18 EEST 2005 org/apache/
> >      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/
> >      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/valid/
> >    902 Sun May 01 14:06:18 EEST 2005
> > org/apache/tapestry/valid/ValidationStrings_fr.properties
> >   
> Hello,
> Thank you Len.
> 
> That is great for default validation messages translation, but not for 
> 'custom' messages, isn't it ?

You are right. For custom messages either for page/component
translations or other messages in the application I know only of 2
mechanisms:

- per page/component messages stored in the
page/component_{locale}.properties which can then be accessed using the
message: syntax, span key = in the template or getMessage in the code. I
do not like this too much because you end up having a lot of files
- global using the standard java MessageStore mechanism but then you end
up with very large files and it's totaly separated from tapestry
mechanisms.

I think this choice depends on you mechanism for editing the ressource
files later. I found some tools: http://freshmeat.net/projects/jinto/ or
http://freshmeat.net/projects/prbeditor/ but this is a completely
different question

Len
www.len.ro


> Cyrille.
> > Hope it helps,
> > Len
> >
> > On Mon, 2006-12-18 at 22:27 +0100, Cyrille37 wrote:
> >
> >   
> >> Hello,
> >>
> >> I was coming mad when trying to localize my validation messages.
> >> After some search I've found a thread in that list which explain that:
> >>
> >> [quote] 
> >> That's because Tapestry looks for "username-not-unique" in the properties
> >> file bundeled with Tapestry. To override it, your 
> >> ValidationStrings.properties should have this path
> >> {CLASS_PATH_ROOT}/org/apache/tapestry/valid/ValidationStrings.properties.
> >> To do that:
> >> create the package /org/apache/tapestry/valid/ under your source folder 
> >> and place your custom ValidationStrings.properties there.
> >> [/quote]
> >>
> >> Here there another way to localize validation messages ?
> >> I hope there is a cleanest method.
> >>
> >> How do you manage that case ?
> >> Thanks
> >> Cyrille
> >>
> >>     
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

Re: Localized validation messages

Posted by Martin Strand <do...@gmail.com>.
for custom validation messages you can do something like this:

<input jwcid="..." validators="validators:required[%your-message-key]"/>

note the % in front of the message key

read more here:
http://tapestry.apache.org/tapestry4.1/usersguide/validation.html

On Tue, 19 Dec 2006 11:22:31 +0100, Cyrille37 <cy...@gmail.com> wrote:

> Marilen Corciovei a écrit :
>> In fact you don't need to overwrite the ValidationStrings.properties
>> which is supposed to be the default one. You just need to have the
>> ValidationStrings_{locale_code}.properties. In order to add french
>> validation to Tapestry I created a Tapestry-french-validation.jar in the
>> lib with the following content:
>>
>> jar tvf Tapestry-french-validation.jar      0 Sun May 01 14:06:18 EEST  
>> 2005 META-INF/
>>    106 Sun May 01 14:06:16 EEST 2005 META-INF/MANIFEST.MF
>>      0 Sun May 01 14:06:18 EEST 2005 org/
>>      0 Sun May 01 14:06:18 EEST 2005 org/apache/
>>      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/
>>      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/valid/
>>    902 Sun May 01 14:06:18 EEST 2005
>> org/apache/tapestry/valid/ValidationStrings_fr.properties
>>
> Hello,
> Thank you Len.
>
> That is great for default validation messages translation, but not for  
> 'custom' messages, isn't it ?
>
> Cyrille.
>> Hope it helps,
>> Len
>>
>> On Mon, 2006-12-18 at 22:27 +0100, Cyrille37 wrote:
>>
>>
>>> Hello,
>>>
>>> I was coming mad when trying to localize my validation messages.
>>> After some search I've found a thread in that list which explain that:
>>>
>>> [quote] That's because Tapestry looks for "username-not-unique" in the  
>>> properties
>>> file bundeled with Tapestry. To override it, your  
>>> ValidationStrings.properties should have this path
>>> {CLASS_PATH_ROOT}/org/apache/tapestry/valid/ValidationStrings.properties.
>>> To do that:
>>> create the package /org/apache/tapestry/valid/ under your source  
>>> folder and place your custom ValidationStrings.properties there.
>>> [/quote]
>>>
>>> Here there another way to localize validation messages ?
>>> I hope there is a cleanest method.
>>>
>>> How do you manage that case ?
>>> Thanks
>>> Cyrille

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


Re: Localized validation messages

Posted by Cyrille37 <cy...@gmail.com>.
Marilen Corciovei a écrit :
> In fact you don't need to overwrite the ValidationStrings.properties
> which is supposed to be the default one. You just need to have the
> ValidationStrings_{locale_code}.properties. In order to add french
> validation to Tapestry I created a Tapestry-french-validation.jar in the
> lib with the following content:
>
> jar tvf Tapestry-french-validation.jar 
>
>      0 Sun May 01 14:06:18 EEST 2005 META-INF/
>    106 Sun May 01 14:06:16 EEST 2005 META-INF/MANIFEST.MF
>      0 Sun May 01 14:06:18 EEST 2005 org/
>      0 Sun May 01 14:06:18 EEST 2005 org/apache/
>      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/
>      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/valid/
>    902 Sun May 01 14:06:18 EEST 2005
> org/apache/tapestry/valid/ValidationStrings_fr.properties
>   
Hello,
Thank you Len.

That is great for default validation messages translation, but not for 
'custom' messages, isn't it ?

Cyrille.
> Hope it helps,
> Len
>
> On Mon, 2006-12-18 at 22:27 +0100, Cyrille37 wrote:
>
>   
>> Hello,
>>
>> I was coming mad when trying to localize my validation messages.
>> After some search I've found a thread in that list which explain that:
>>
>> [quote] 
>> That's because Tapestry looks for "username-not-unique" in the properties
>> file bundeled with Tapestry. To override it, your 
>> ValidationStrings.properties should have this path
>> {CLASS_PATH_ROOT}/org/apache/tapestry/valid/ValidationStrings.properties.
>> To do that:
>> create the package /org/apache/tapestry/valid/ under your source folder 
>> and place your custom ValidationStrings.properties there.
>> [/quote]
>>
>> Here there another way to localize validation messages ?
>> I hope there is a cleanest method.
>>
>> How do you manage that case ?
>> Thanks
>> Cyrille
>>
>>     



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


Re: Localized validation messages

Posted by Greg Ward <ge...@gmail.com>.
On 12/19/06, Marilen Corciovei <le...@nemesisit.rdsnet.ro> wrote:
> In fact you don't need to overwrite the ValidationStrings.properties
> which is supposed to be the default one. You just need to have the
> ValidationStrings_{locale_code}.properties. In order to add french
> validation to Tapestry I created a Tapestry-french-validation.jar in the
> lib with the following content:
>
> jar tvf Tapestry-french-validation.jar
>
>      0 Sun May 01 14:06:18 EEST 2005 META-INF/
>    106 Sun May 01 14:06:16 EEST 2005 META-INF/MANIFEST.MF
>      0 Sun May 01 14:06:18 EEST 2005 org/
>      0 Sun May 01 14:06:18 EEST 2005 org/apache/
>      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/
>      0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/valid/
>    902 Sun May 01 14:06:18 EEST 2005
> org/apache/tapestry/valid/ValidationStrings_fr.properties

We have exactly the same problem... do you suppose you could share
your ValidationStrings_fr.properties so we don't have to translate it
ourselves?

Thanks --

Greg

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


Re: Localized validation messages

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
In fact you don't need to overwrite the ValidationStrings.properties
which is supposed to be the default one. You just need to have the
ValidationStrings_{locale_code}.properties. In order to add french
validation to Tapestry I created a Tapestry-french-validation.jar in the
lib with the following content:

jar tvf Tapestry-french-validation.jar 

     0 Sun May 01 14:06:18 EEST 2005 META-INF/
   106 Sun May 01 14:06:16 EEST 2005 META-INF/MANIFEST.MF
     0 Sun May 01 14:06:18 EEST 2005 org/
     0 Sun May 01 14:06:18 EEST 2005 org/apache/
     0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/
     0 Sun May 01 14:06:18 EEST 2005 org/apache/tapestry/valid/
   902 Sun May 01 14:06:18 EEST 2005
org/apache/tapestry/valid/ValidationStrings_fr.properties

Hope it helps,
Len

On Mon, 2006-12-18 at 22:27 +0100, Cyrille37 wrote:

> Hello,
> 
> I was coming mad when trying to localize my validation messages.
> After some search I've found a thread in that list which explain that:
> 
> [quote] 
> That's because Tapestry looks for "username-not-unique" in the properties
> file bundeled with Tapestry. To override it, your 
> ValidationStrings.properties should have this path
> {CLASS_PATH_ROOT}/org/apache/tapestry/valid/ValidationStrings.properties.
> To do that:
> create the package /org/apache/tapestry/valid/ under your source folder 
> and place your custom ValidationStrings.properties there.
> [/quote]
> 
> Here there another way to localize validation messages ?
> I hope there is a cleanest method.
> 
> How do you manage that case ?
> Thanks
> Cyrille
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>