Struts validation & internationalization
I'm not sure how to deploy an application that will allow two users using different locals to use it at the same time.
I have an application that needs to be used by en_US and es_MX.
I have the following files defined.
application_es_MX.properties
application_en_US.properties
validation_en_US.xml
validation_es_MX.xml
validation-global_en_US.xml - defines a date format ${date}
validation-global_es_MX.xml
I had it without the _es_MX or the en_US with just one set of files and it worked just fine. Now it doesn't work in either language. I'm sure there are probably settings I'm forgetting.. but anyone have any pointers.
[688 byte] By [
gmachamera] at [2007-11-26 15:17:14]

# 1
just found this in my struts-config.xml, doesn't seem like this is what needs to be in there if it is going to pick up validation based on locale
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/plugin-config/validator/validator-rules.xml,/WEB-INF/plugin-config/validator/validation-global.xml,/WEB-INF/plugin-config/validator/validation-AC.xml,/WEB-INF/plugin-config/validator/validation-GM.xml,/WEB-INF/plugin-config/validator/validation-JJ.xml,/WEB-INF/plugin-config/validator/validation-RM.xml,/WEB-INF/plugin-config/validator/validation-SD.xml,/WEB-INF/plugin-config/validator/validation-AF.xml,/WEB-INF/plugin-config/validator/validation-GENERATED.xml" />
<!-- <set-property property="stopOnFirstError" value="false"/> -->
</plug-in>
# 2
I found that I can use sepereate formsets, but my file is already 70,000 lines long... as the product base grows I will need to support more and more languages, so I don't want to have to keep copying formsets.
I'm already generating date fields with a custom tag that adds a calandar controll (dynarch's). I'll just add a validation method to the onblur of the date field as it's generated.
It just feels wrong to remove struts validation from the application.
# 3
I found an article that explains how to do this.. but I can't seem to make it work. (using locale date in struts validation)
http://www.javaworld.com/javaworld/jw-05-2004/jw-0524-i18n.html?page=6
The javascript that gets generated doesn't seem to want to use the variable that I defined.
<field property="idfPtphdt050"
depends="date">
<arg0 key="PTPHDTForm.idfPtphdt050"/>
<var>
<var-name>datePattern</var-name>
<var-value>dateFormat</var-value>
</var>
</field>
where dateFormat is a variable defined on my jsp as "MM/dd/yyyy"
anyone ever used this method before?