You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Hubert Rabago <ja...@yahoo.com> on 2004/04/13 09:25:03 UTC

Validator I18n configuration

Just floating an idea.

In Validator, to use different formats for different locales, you need to
create entirely new <formset>s.  Since validator can accept multiple config
files, then we can just have one config per locale, and it all works out
okay, kinda.  
However, we already have a set of locale-specific files - the message
resources.  
What do you think of placing the validation formats in the locale-specific
message resource file?  

So instead of multiple validation config files containing the same rules for
the same field:
<field property="birth" depends="required,date">
    <arg0 key="employeeform.birth.displayname"/>
    <var>
        <var-name>datePatternStrict</var-name>
        <var-value>MM/dd/yyyy</var-value>
    </var>
</field>

We can have one validation config with one entry for our one field:
<field property="birth" depends="required,date">
    <arg0 key="employeeform.birth.displayname"/>
    <var>
        <var-name>datePatternStrict</var-name>
        <var-value key="myForm.birth.validationPattern"/>
    </var>
</field>

When a different locale is being used, the locale's message resource file
will contain the locale-specific validation pattern.  This way, we won't need
multiple locale-specific files and the repetition of information is greatly
reduced.  Granted it's not a one-size-fits-all solution (some locales may
require add'l address fields), so for those cases the existing
multiple-config file will have to do.

Like I said, just floating an idea.

Hubert



	
		
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org