You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Ewers <ew...@gmx.de> on 2005/09/14 16:06:42 UTC

Some i18n issues

Hi,

I'm new to this group so first of all I'm pleased to have the opportunity to
ask questions here.

My question(s):
1) I'm trying to write an application that supports i18n with Struts. I use
DynaActionForm for my forms, so I defined them with initial values, e.g.:
<form-bean name="productForm"
     type="org.apache.struts.validator.DynaValidatorForm">
     ....
     <form-property name="listprice" type="java.lang.String" initial="1.000"
/>
</form-bean>
I have German and English users. My problem is that it seems to be
impossible to definie initial values for different languages. "1.000" in
Germany means 1000, in UK it means 1. For German users the initial value
should be "1,000".
Is there a solution for this problem?

2) If I use the Validator framework to validate double form values, it's
basically the same problem: Validator seems to know English writing rules of
double values but "1,00" is not a valid double value for Validator, even if
the browser's Locale is set to German.
Is there a solution?

Bye,
Michael.

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


Re: Some i18n issues

Posted by Ivan Rodriguez <iv...@interd4u.com>.
I think the *cleanest* way is to format data at presentation layer 
(jsp). Last example from Laurie is quite correct and clean, if it is too 
long code let get a try with JSTL and
Struts-EL taglibs (<html-el:text>)

Michael Ewers escribió:

> Hi,
>
> To avoid misunderstandings: My goal is to have a DynaActionForm 
> definition's "initial"-value translated in a locale specific manner so 
> that e.g. the <html:text>-tag displays a initial="1,001.00" as a 
> "1.001,00" in German locale Browsers.
> After reading some struts-code I think that the best (meaning 
> "cleanest") way to do it ist to change the classes that prepopulate 
> DynActionForms from the "initial" attribute. That won't be easy 
> because the forms are populated when the modules are configured. That 
> means there's no locale available by then. That's why I might have to 
> change some more classes.
> I'll try to do those changes and offer the patches on the dev-list.
>
> Michael.



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


Re: Some i18n issues

Posted by Michael Ewers <ew...@gmx.de>.
Hi,

To avoid misunderstandings: My goal is to have a DynaActionForm 
definition's "initial"-value translated in a locale specific manner so 
that e.g. the <html:text>-tag displays a initial="1,001.00" as a 
"1.001,00" in German locale Browsers.
After reading some struts-code I think that the best (meaning 
"cleanest") way to do it ist to change the classes that prepopulate 
DynActionForms from the "initial" attribute. That won't be easy because 
the forms are populated when the modules are configured. That means 
there's no locale available by then. That's why I might have to change 
some more classes.
I'll try to do those changes and offer the patches on the dev-list.

Michael.

>From: "Laurie Harper" <la...@holoweb.net>
>
>  
>
>>Michael Ewers wrote:
>>    
>>
>>>Can anyone see a reason why the html:text implementation in
>>>      
>>>
>struts-html.tld
>  
>
>>>doesn't support a formatKey attribute?
>>>      
>>>
>>I guess because there are already ways to format values which can be
>>composed with <html:text/> so it doesn't *need* to support it. If
>>there's some reason that approach wont work in some situation or other,
>>or if you feel strongly that the convenience of adding formatKey to
>><html:text/> and/or other tags outweighs the API bloat, you can submit
>>an enhancement request, though.
>>
>>    
>>
>>>To whom can I send patches that I write?
>>>      
>>>
>>The best way is to open a ticket in Bugzilla and attach patches there.
>>Posting to / nagging on the dev list is the best way to get the patches
>>looked at and would be the best place to ask whether such patches are
>>likely to be accepted.
>>    
>>
>
>http://issues.apache.org/bugzilla/show_bug.cgi?id=22991
>
>Niall
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>  
>


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


Re: Some i18n issues

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
From: "Laurie Harper" <la...@holoweb.net>

> Michael Ewers wrote:
> > Can anyone see a reason why the html:text implementation in
struts-html.tld
> > doesn't support a formatKey attribute?
>
> I guess because there are already ways to format values which can be
> composed with <html:text/> so it doesn't *need* to support it. If
> there's some reason that approach wont work in some situation or other,
> or if you feel strongly that the convenience of adding formatKey to
> <html:text/> and/or other tags outweighs the API bloat, you can submit
> an enhancement request, though.
>
> > To whom can I send patches that I write?
>
> The best way is to open a ticket in Bugzilla and attach patches there.
> Posting to / nagging on the dev list is the best way to get the patches
> looked at and would be the best place to ask whether such patches are
> likely to be accepted.

http://issues.apache.org/bugzilla/show_bug.cgi?id=22991

Niall



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


Re: Some i18n issues

Posted by Laurie Harper <la...@holoweb.net>.
Michael Ewers wrote:
> Can anyone see a reason why the html:text implementation in struts-html.tld
> doesn't support a formatKey attribute?

I guess because there are already ways to format values which can be 
composed with <html:text/> so it doesn't *need* to support it. If 
there's some reason that approach wont work in some situation or other, 
or if you feel strongly that the convenience of adding formatKey to 
<html:text/> and/or other tags outweighs the API bloat, you can submit 
an enhancement request, though.

> To whom can I send patches that I write?

The best way is to open a ticket in Bugzilla and attach patches there. 
Posting to / nagging on the dev list is the best way to get the patches 
looked at and would be the best place to ask whether such patches are 
likely to be accepted.

L.

> 
> Thanks,
> Michael.
> 
> 
>>That doesn't allow the use of the Struts HTML tags though, since you 
>>can't use a tag in a tag attribute... This will work, though:
>>
>>   <html:text name="...">
>>     <jsp:attribute name="value">
>>       <bean:write name="productForm" property="listprice"
>>                   formatKey="format.number"/>
>>     </jsp:attribute>
>>   </html:text>
>>
>>A little cumbersome, and not the only way. You can also do it without a 
>>nested <jsp:attribute/> if you don't mind creating a scripting variable.
>>
>>L.
>>
>>Ivan Rodriguez wrote:
>>
>>><input type="text" name="productForm.listprice" value="<bean:write 
>>>name="productForm" property="listprice" formatKey="format.number" />">
>>>
>>>
>>>Michael Ewers escribió:
>>>
>>>
>>>>The problem is that the <html:text> tag doesn't have a 
>>>>formatKey-attribute
>>>>and I want the initial value to be displayed in a text-field, not as a 
>>>>pure
>>>>html-output.
>>>>In other words: I need struts to make a "<input type="text"
>>>>name="propertyName" value="1000,00">" out of a "...initial="1000" with
>>>>German locale set in browser.
>>>>
>>>>Thans,
>>>>Michael.
>>>>
>>>> 
>>>>
>>>>
>>>>>You have to use an initial value of "1000".
>>>>>
>>>>><form-bean name="productForm"
>>>>>    type="org.apache.struts.validator.DynaValidatorForm">
>>>>>    ....
>>>>>    <form-property name="listprice" type="java.lang.String"
>>>>>initial="1000"
>>>>>/>
>>>>></form-bean>
>>>>>
>>>>>
>>>>>
>>>>>Then where you print this initial value, at your jsp, use formatting 
>>>>>options:
>>>>>
>>>>><bean:write name="productForm" property="listprice" 
>>>>>formatKey="format.number" />
>>>>>
>>>>>format.number is an entry in you MessageResources.properties
>>>>>
>>>>>For german MessageResources_de.properties:
>>>>>format.number=#0.000,00
>>>>>
>>>>>For english MessageResources_en.properties:
>>>>>format.number=#0,000.00
>>>>>
>>>>>
>>>>>Michael Ewers escribió:
>>>>>
>>>>>  
>>>>>
>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>I'm new to this group so first of all I'm pleased to have the 
>>>>>>opportunity
>>>>>>    
>>>>>
>>>>>to
>>>>>  
>>>>>
>>>>>
>>>>>>ask questions here.
>>>>>>
>>>>>>My question(s):
>>>>>>1) I'm trying to write an application that supports i18n with Struts.
>>
>>I
>>
>>>>>>    
>>>>>
>>>>>use
>>>>>  
>>>>>
>>>>>
>>>>>>DynaActionForm for my forms, so I defined them with initial values, 
>>>>>>e.g.:
>>>>>><form-bean name="productForm"
>>>>>>   type="org.apache.struts.validator.DynaValidatorForm">
>>>>>>   ....
>>>>>>   <form-property name="listprice" type="java.lang.String"
>>>>>>    
>>>>>
>>>>>initial="1.000"
>>>>>  
>>>>>
>>>>>
>>>>>>/>
>>>>>></form-bean>
>>>>>>I have German and English users. My problem is that it seems to be
>>>>>>impossible to definie initial values for different languages. 
>>>>>>"1.000" in
>>>>>>Germany means 1000, in UK it means 1. For German users the initial 
>>>>>>value
>>>>>>should be "1,000".
>>>>>>Is there a solution for this problem?
>>>>>>
>>>>>>2) If I use the Validator framework to validate double form values, 
>>>>>>it's
>>>>>>basically the same problem: Validator seems to know English writing 
>>>>>>rules
>>>>>>    
>>>>>
>>>>>of
>>>>>  
>>>>>
>>>>>
>>>>>>double values but "1,00" is not a valid double value for Validator, 
>>>>>>even
>>>>>>    
>>>>>
>>>>>if
>>>>>  
>>>>>
>>>>>
>>>>>>the browser's Locale is set to German.
>>>>>>Is there a solution?
>>>>>>
>>>>>>Bye,
>>>>>>Michael.
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>    
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>  
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>> 
>>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>


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


Re: Some i18n issues

Posted by Michael Ewers <ew...@gmx.de>.
Can anyone see a reason why the html:text implementation in struts-html.tld
doesn't support a formatKey attribute?

To whom can I send patches that I write?

Thanks,
Michael.

> That doesn't allow the use of the Struts HTML tags though, since you 
> can't use a tag in a tag attribute... This will work, though:
> 
>    <html:text name="...">
>      <jsp:attribute name="value">
>        <bean:write name="productForm" property="listprice"
>                    formatKey="format.number"/>
>      </jsp:attribute>
>    </html:text>
> 
> A little cumbersome, and not the only way. You can also do it without a 
> nested <jsp:attribute/> if you don't mind creating a scripting variable.
> 
> L.
> 
> Ivan Rodriguez wrote:
> > <input type="text" name="productForm.listprice" value="<bean:write 
> > name="productForm" property="listprice" formatKey="format.number" />">
> > 
> > 
> > Michael Ewers escribió:
> > 
> >> The problem is that the <html:text> tag doesn't have a 
> >> formatKey-attribute
> >> and I want the initial value to be displayed in a text-field, not as a 
> >> pure
> >> html-output.
> >> In other words: I need struts to make a "<input type="text"
> >> name="propertyName" value="1000,00">" out of a "...initial="1000" with
> >> German locale set in browser.
> >>
> >> Thans,
> >> Michael.
> >>
> >>  
> >>
> >>> You have to use an initial value of "1000".
> >>>
> >>> <form-bean name="productForm"
> >>>     type="org.apache.struts.validator.DynaValidatorForm">
> >>>     ....
> >>>     <form-property name="listprice" type="java.lang.String"
> >>> initial="1000"
> >>> />
> >>> </form-bean>
> >>>
> >>>
> >>>
> >>> Then where you print this initial value, at your jsp, use formatting 
> >>> options:
> >>>
> >>> <bean:write name="productForm" property="listprice" 
> >>> formatKey="format.number" />
> >>>
> >>> format.number is an entry in you MessageResources.properties
> >>>
> >>> For german MessageResources_de.properties:
> >>> format.number=#0.000,00
> >>>
> >>> For english MessageResources_en.properties:
> >>> format.number=#0,000.00
> >>>
> >>>
> >>> Michael Ewers escribió:
> >>>
> >>>   
> >>>
> >>>> Hi,
> >>>>
> >>>> I'm new to this group so first of all I'm pleased to have the 
> >>>> opportunity
> >>>>     
> >>>
> >>> to
> >>>   
> >>>
> >>>> ask questions here.
> >>>>
> >>>> My question(s):
> >>>> 1) I'm trying to write an application that supports i18n with Struts.
> I
> >>>>     
> >>>
> >>> use
> >>>   
> >>>
> >>>> DynaActionForm for my forms, so I defined them with initial values, 
> >>>> e.g.:
> >>>> <form-bean name="productForm"
> >>>>    type="org.apache.struts.validator.DynaValidatorForm">
> >>>>    ....
> >>>>    <form-property name="listprice" type="java.lang.String"
> >>>>     
> >>>
> >>> initial="1.000"
> >>>   
> >>>
> >>>> />
> >>>> </form-bean>
> >>>> I have German and English users. My problem is that it seems to be
> >>>> impossible to definie initial values for different languages. 
> >>>> "1.000" in
> >>>> Germany means 1000, in UK it means 1. For German users the initial 
> >>>> value
> >>>> should be "1,000".
> >>>> Is there a solution for this problem?
> >>>>
> >>>> 2) If I use the Validator framework to validate double form values, 
> >>>> it's
> >>>> basically the same problem: Validator seems to know English writing 
> >>>> rules
> >>>>     
> >>>
> >>> of
> >>>   
> >>>
> >>>> double values but "1,00" is not a valid double value for Validator, 
> >>>> even
> >>>>     
> >>>
> >>> if
> >>>   
> >>>
> >>>> the browser's Locale is set to German.
> >>>> Is there a solution?
> >>>>
> >>>> Bye,
> >>>> Michael.
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>> For additional commands, e-mail: user-help@struts.apache.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>     
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>> For additional commands, e-mail: user-help@struts.apache.org
> >>>
> >>>   
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >>
> >>  
> >>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

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


Re: Some i18n issues

Posted by Laurie Harper <la...@holoweb.net>.
That doesn't allow the use of the Struts HTML tags though, since you 
can't use a tag in a tag attribute... This will work, though:

   <html:text name="...">
     <jsp:attribute name="value">
       <bean:write name="productForm" property="listprice"
                   formatKey="format.number"/>
     </jsp:attribute>
   </html:text>

A little cumbersome, and not the only way. You can also do it without a 
nested <jsp:attribute/> if you don't mind creating a scripting variable.

L.

Ivan Rodriguez wrote:
> <input type="text" name="productForm.listprice" value="<bean:write 
> name="productForm" property="listprice" formatKey="format.number" />">
> 
> 
> Michael Ewers escribió:
> 
>> The problem is that the <html:text> tag doesn't have a 
>> formatKey-attribute
>> and I want the initial value to be displayed in a text-field, not as a 
>> pure
>> html-output.
>> In other words: I need struts to make a "<input type="text"
>> name="propertyName" value="1000,00">" out of a "...initial="1000" with
>> German locale set in browser.
>>
>> Thans,
>> Michael.
>>
>>  
>>
>>> You have to use an initial value of "1000".
>>>
>>> <form-bean name="productForm"
>>>     type="org.apache.struts.validator.DynaValidatorForm">
>>>     ....
>>>     <form-property name="listprice" type="java.lang.String"
>>> initial="1000"
>>> />
>>> </form-bean>
>>>
>>>
>>>
>>> Then where you print this initial value, at your jsp, use formatting 
>>> options:
>>>
>>> <bean:write name="productForm" property="listprice" 
>>> formatKey="format.number" />
>>>
>>> format.number is an entry in you MessageResources.properties
>>>
>>> For german MessageResources_de.properties:
>>> format.number=#0.000,00
>>>
>>> For english MessageResources_en.properties:
>>> format.number=#0,000.00
>>>
>>>
>>> Michael Ewers escribió:
>>>
>>>   
>>>
>>>> Hi,
>>>>
>>>> I'm new to this group so first of all I'm pleased to have the 
>>>> opportunity
>>>>     
>>>
>>> to
>>>   
>>>
>>>> ask questions here.
>>>>
>>>> My question(s):
>>>> 1) I'm trying to write an application that supports i18n with Struts. I
>>>>     
>>>
>>> use
>>>   
>>>
>>>> DynaActionForm for my forms, so I defined them with initial values, 
>>>> e.g.:
>>>> <form-bean name="productForm"
>>>>    type="org.apache.struts.validator.DynaValidatorForm">
>>>>    ....
>>>>    <form-property name="listprice" type="java.lang.String"
>>>>     
>>>
>>> initial="1.000"
>>>   
>>>
>>>> />
>>>> </form-bean>
>>>> I have German and English users. My problem is that it seems to be
>>>> impossible to definie initial values for different languages. 
>>>> "1.000" in
>>>> Germany means 1000, in UK it means 1. For German users the initial 
>>>> value
>>>> should be "1,000".
>>>> Is there a solution for this problem?
>>>>
>>>> 2) If I use the Validator framework to validate double form values, 
>>>> it's
>>>> basically the same problem: Validator seems to know English writing 
>>>> rules
>>>>     
>>>
>>> of
>>>   
>>>
>>>> double values but "1,00" is not a valid double value for Validator, 
>>>> even
>>>>     
>>>
>>> if
>>>   
>>>
>>>> the browser's Locale is set to German.
>>>> Is there a solution?
>>>>
>>>> Bye,
>>>> Michael.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>     
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>   
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>  
>>


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


Re: Some i18n issues

Posted by Ivan Rodriguez <iv...@interd4u.com>.
<input type="text" name="productForm.listprice" value="<bean:write 
name="productForm" property="listprice" formatKey="format.number" />">


Michael Ewers escribió:

>The problem is that the <html:text> tag doesn't have a formatKey-attribute
>and I want the initial value to be displayed in a text-field, not as a pure
>html-output.
>In other words: I need struts to make a "<input type="text"
>name="propertyName" value="1000,00">" out of a "...initial="1000" with
>German locale set in browser.
>
>Thans,
>Michael.
>
>  
>
>>You have to use an initial value of "1000".
>>
>><form-bean name="productForm"
>>     type="org.apache.struts.validator.DynaValidatorForm">
>>     ....
>>     <form-property name="listprice" type="java.lang.String"
>>initial="1000"
>>/>
>></form-bean>
>>
>>
>>
>>Then where you print this initial value, at your jsp, use formatting 
>>options:
>>
>><bean:write name="productForm" property="listprice" 
>>formatKey="format.number" />
>>
>>format.number is an entry in you MessageResources.properties
>>
>>For german MessageResources_de.properties:
>>format.number=#0.000,00
>>
>>For english MessageResources_en.properties:
>>format.number=#0,000.00
>>
>>
>>Michael Ewers escribió:
>>
>>    
>>
>>>Hi,
>>>
>>>I'm new to this group so first of all I'm pleased to have the opportunity
>>>      
>>>
>>to
>>    
>>
>>>ask questions here.
>>>
>>>My question(s):
>>>1) I'm trying to write an application that supports i18n with Struts. I
>>>      
>>>
>>use
>>    
>>
>>>DynaActionForm for my forms, so I defined them with initial values, e.g.:
>>><form-bean name="productForm"
>>>    type="org.apache.struts.validator.DynaValidatorForm">
>>>    ....
>>>    <form-property name="listprice" type="java.lang.String"
>>>      
>>>
>>initial="1.000"
>>    
>>
>>>/>
>>></form-bean>
>>>I have German and English users. My problem is that it seems to be
>>>impossible to definie initial values for different languages. "1.000" in
>>>Germany means 1000, in UK it means 1. For German users the initial value
>>>should be "1,000".
>>>Is there a solution for this problem?
>>>
>>>2) If I use the Validator framework to validate double form values, it's
>>>basically the same problem: Validator seems to know English writing rules
>>>      
>>>
>>of
>>    
>>
>>>double values but "1,00" is not a valid double value for Validator, even
>>>      
>>>
>>if
>>    
>>
>>>the browser's Locale is set to German.
>>>Is there a solution?
>>>
>>>Bye,
>>>Michael.
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>> 
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>  
>


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


Re: Some i18n issues

Posted by Michael Ewers <ew...@gmx.de>.
The problem is that the <html:text> tag doesn't have a formatKey-attribute
and I want the initial value to be displayed in a text-field, not as a pure
html-output.
In other words: I need struts to make a "<input type="text"
name="propertyName" value="1000,00">" out of a "...initial="1000" with
German locale set in browser.

Thans,
Michael.

> You have to use an initial value of "1000".
> 
> <form-bean name="productForm"
>      type="org.apache.struts.validator.DynaValidatorForm">
>      ....
>      <form-property name="listprice" type="java.lang.String"
> initial="1000"
> />
> </form-bean>
> 
> 
> 
> Then where you print this initial value, at your jsp, use formatting 
> options:
> 
> <bean:write name="productForm" property="listprice" 
> formatKey="format.number" />
> 
> format.number is an entry in you MessageResources.properties
> 
> For german MessageResources_de.properties:
> format.number=#0.000,00
> 
> For english MessageResources_en.properties:
> format.number=#0,000.00
> 
> 
> Michael Ewers escribió:
> 
> >Hi,
> >
> >I'm new to this group so first of all I'm pleased to have the opportunity
> to
> >ask questions here.
> >
> >My question(s):
> >1) I'm trying to write an application that supports i18n with Struts. I
> use
> >DynaActionForm for my forms, so I defined them with initial values, e.g.:
> ><form-bean name="productForm"
> >     type="org.apache.struts.validator.DynaValidatorForm">
> >     ....
> >     <form-property name="listprice" type="java.lang.String"
> initial="1.000"
> >/>
> ></form-bean>
> >I have German and English users. My problem is that it seems to be
> >impossible to definie initial values for different languages. "1.000" in
> >Germany means 1000, in UK it means 1. For German users the initial value
> >should be "1,000".
> >Is there a solution for this problem?
> >
> >2) If I use the Validator framework to validate double form values, it's
> >basically the same problem: Validator seems to know English writing rules
> of
> >double values but "1,00" is not a valid double value for Validator, even
> if
> >the browser's Locale is set to German.
> >Is there a solution?
> >
> >Bye,
> >Michael.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

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


Re: Some i18n issues

Posted by Michael Ewers <ew...@gmx.de>.
I've set up a workaround overwriting some Validator-classes to make the
validator locale-aware. But I can't believe no validator-commiter noticed
the problem before and changed the code in CVS. Maybe I'll post my
replacement code in Validator Dev-List.

Thanks,
Michael.

> --- Ursprüngliche Nachricht ---
> Von: Laurie Harper <la...@holoweb.net>
> An: user@struts.apache.org
> Betreff: Re: Some i18n issues
> Datum: Wed, 14 Sep 2005 11:20:17 -0400
> 
> And for the validator issue, you can localize your validation rules by 
> defining a seperate set for each locale. I don't know if there's a way 
> to make the standard, included validations locale-aware but you can 
> define alternates where necessary if not. Also, Struts 1.3 will 
> introduce an 'extends' mechanism which will let you only override 
> validations for those fields that are locale sensitive without having to 
> repeat the rest.
> 
> L.
> 
> Ivan Rodriguez wrote:
> > You have to use an initial value of "1000".
> > 
> > <form-bean name="productForm"
> >     type="org.apache.struts.validator.DynaValidatorForm">
> >     ....
> >     <form-property name="listprice" type="java.lang.String"
> initial="1000"
> > />
> > </form-bean>
> > 
> > 
> > 
> > Then where you print this initial value, at your jsp, use formatting 
> > options:
> > 
> > <bean:write name="productForm" property="listprice" 
> > formatKey="format.number" />
> > 
> > format.number is an entry in you MessageResources.properties
> > 
> > For german MessageResources_de.properties:
> > format.number=#0.000,00
> > 
> > For english MessageResources_en.properties:
> > format.number=#0,000.00
> > 
> > 
> > Michael Ewers escribió:
> > 
> >> Hi,
> >>
> >> I'm new to this group so first of all I'm pleased to have the 
> >> opportunity to
> >> ask questions here.
> >>
> >> My question(s):
> >> 1) I'm trying to write an application that supports i18n with Struts. 
> >> I use
> >> DynaActionForm for my forms, so I defined them with initial values,
> e.g.:
> >> <form-bean name="productForm"
> >>     type="org.apache.struts.validator.DynaValidatorForm">
> >>     ....
> >>     <form-property name="listprice" type="java.lang.String" 
> >> initial="1.000"
> >> />
> >> </form-bean>
> >> I have German and English users. My problem is that it seems to be
> >> impossible to definie initial values for different languages. "1.000"
> in
> >> Germany means 1000, in UK it means 1. For German users the initial
> value
> >> should be "1,000".
> >> Is there a solution for this problem?
> >>
> >> 2) If I use the Validator framework to validate double form values,
> it's
> >> basically the same problem: Validator seems to know English writing 
> >> rules of
> >> double values but "1,00" is not a valid double value for Validator, 
> >> even if
> >> the browser's Locale is set to German.
> >> Is there a solution?
> >>
> >> Bye,
> >> Michael.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >>
> >>  
> >>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

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


Re: Some i18n issues

Posted by Laurie Harper <la...@holoweb.net>.
And for the validator issue, you can localize your validation rules by 
defining a seperate set for each locale. I don't know if there's a way 
to make the standard, included validations locale-aware but you can 
define alternates where necessary if not. Also, Struts 1.3 will 
introduce an 'extends' mechanism which will let you only override 
validations for those fields that are locale sensitive without having to 
repeat the rest.

L.

Ivan Rodriguez wrote:
> You have to use an initial value of "1000".
> 
> <form-bean name="productForm"
>     type="org.apache.struts.validator.DynaValidatorForm">
>     ....
>     <form-property name="listprice" type="java.lang.String" initial="1000"
> />
> </form-bean>
> 
> 
> 
> Then where you print this initial value, at your jsp, use formatting 
> options:
> 
> <bean:write name="productForm" property="listprice" 
> formatKey="format.number" />
> 
> format.number is an entry in you MessageResources.properties
> 
> For german MessageResources_de.properties:
> format.number=#0.000,00
> 
> For english MessageResources_en.properties:
> format.number=#0,000.00
> 
> 
> Michael Ewers escribió:
> 
>> Hi,
>>
>> I'm new to this group so first of all I'm pleased to have the 
>> opportunity to
>> ask questions here.
>>
>> My question(s):
>> 1) I'm trying to write an application that supports i18n with Struts. 
>> I use
>> DynaActionForm for my forms, so I defined them with initial values, e.g.:
>> <form-bean name="productForm"
>>     type="org.apache.struts.validator.DynaValidatorForm">
>>     ....
>>     <form-property name="listprice" type="java.lang.String" 
>> initial="1.000"
>> />
>> </form-bean>
>> I have German and English users. My problem is that it seems to be
>> impossible to definie initial values for different languages. "1.000" in
>> Germany means 1000, in UK it means 1. For German users the initial value
>> should be "1,000".
>> Is there a solution for this problem?
>>
>> 2) If I use the Validator framework to validate double form values, it's
>> basically the same problem: Validator seems to know English writing 
>> rules of
>> double values but "1,00" is not a valid double value for Validator, 
>> even if
>> the browser's Locale is set to German.
>> Is there a solution?
>>
>> Bye,
>> Michael.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>  
>>


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


Re: Some i18n issues

Posted by Ivan Rodriguez <iv...@interd4u.com>.
You have to use an initial value of "1000".

<form-bean name="productForm"
     type="org.apache.struts.validator.DynaValidatorForm">
     ....
     <form-property name="listprice" type="java.lang.String" initial="1000"
/>
</form-bean>



Then where you print this initial value, at your jsp, use formatting 
options:

<bean:write name="productForm" property="listprice" 
formatKey="format.number" />

format.number is an entry in you MessageResources.properties

For german MessageResources_de.properties:
format.number=#0.000,00

For english MessageResources_en.properties:
format.number=#0,000.00


Michael Ewers escribió:

>Hi,
>
>I'm new to this group so first of all I'm pleased to have the opportunity to
>ask questions here.
>
>My question(s):
>1) I'm trying to write an application that supports i18n with Struts. I use
>DynaActionForm for my forms, so I defined them with initial values, e.g.:
><form-bean name="productForm"
>     type="org.apache.struts.validator.DynaValidatorForm">
>     ....
>     <form-property name="listprice" type="java.lang.String" initial="1.000"
>/>
></form-bean>
>I have German and English users. My problem is that it seems to be
>impossible to definie initial values for different languages. "1.000" in
>Germany means 1000, in UK it means 1. For German users the initial value
>should be "1,000".
>Is there a solution for this problem?
>
>2) If I use the Validator framework to validate double form values, it's
>basically the same problem: Validator seems to know English writing rules of
>double values but "1,00" is not a valid double value for Validator, even if
>the browser's Locale is set to German.
>Is there a solution?
>
>Bye,
>Michael.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>  
>


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