You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Gleison Caetano (JIRA)" <ji...@apache.org> on 2007/11/06 00:59:34 UTC

[jira] Issue Comment Edited: (WW-2176) In Turkish locale "TR" double values are multiplied by ten on every page load

    [ https://issues.apache.org/struts/browse/WW-2176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42577 ] 

gleisoncs edited comment on WW-2176 at 11/5/07 3:58 PM:
--------------------------------------------------------------

We should to turn in pattern inside entity or inside action for example down. I solved this problem like this:

1) in entity:
...
	public Double getVlCust() {
		return vlCust;
	}

	public String getVlCustFormatted() {
		return Utils.convertDoubleToString(vlCust);
	}
...

2) in some class util like Utils:
...
	public static String convertDoubleToString(Double value) {
		return (String) new CurrencyConverter().convert(String.class, value);
	}
...

3) in jsp form:
<s:textfield key="produto.vlCust" value="%{produto.vlCustFormatted}" required="false" cssClass="text medium"/>

4) in jsp list:
<display:column property="vlCustFormatted" sortable="true" titleKey="produto.vlCust"/>

      was (Author: gleisoncs):
    Should we turn pattern in entity or in action for example down. I solved this problem like this:

1) in entity:
...
	public Double getVlCust() {
		return vlCust;
	}

	public String getVlCustFormatted() {
		return Utils.convertDoubleToString(vlCust);
	}
...

2) in some class util like Utils:
...
	public static String convertDoubleToString(Double value) {
		return (String) new CurrencyConverter().convert(String.class, value);
	}
...

3) in jsp form:
<s:textfield key="produto.vlCust" value="%{produto.vlCustFormatted}" required="false" cssClass="text medium"/>

4) in jsp list:
<display:column property="vlCustFormatted" sortable="true" titleKey="produto.vlCust"/>
  
> In Turkish locale "TR" double values are multiplied by ten on every page load
> -----------------------------------------------------------------------------
>
>                 Key: WW-2176
>                 URL: https://issues.apache.org/struts/browse/WW-2176
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0
>         Environment: Windows XP, java 5 and java 6
>            Reporter: Ömer Başar
>            Priority: Blocker
>             Fix For: 2.1.2
>
>         Attachments: struts2locale_error.avi
>
>
> The steps to get the error.
> 1 - Change your locale to "TR" (Turkish)
> 2 - go to edit employee page on showcase application - http://www.planetstruts.org/struts2-showcase/employee/save.action
> 3 - Fill only the salary field with "10"
> 4 - Press Save, it shows the required fields and makes the salary field "10.0"
> 5 - Press Save again without editing anything, it gives the error for required fields and makes the salary field "100.0"
> 6 - Alter the salary field. Make it "100,0" (change dot with comma)
> 7 - press save, here it is not multiplied by 10, but it changes the salary field value from "100,0" to "100.0" again.
> Here is the problem. In Turkish(TR) locale the decimal separator is "comma", not "dot". So it doesn't convert them according to the TR locale which is the locale of my browser. When I press save at the 4th and 5th steps it should write "10,0" using the locale of the browser. 
> Note : When I change my locale to "EN" everything works fine. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.