You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Sebastian (JIRA)" <ji...@apache.org> on 2007/12/04 08:37:33 UTC

[jira] Created: (WW-2349) localized conversion from double to string broken

localized conversion from double to string broken
-------------------------------------------------

                 Key: WW-2349
                 URL: https://issues.apache.org/struts/browse/WW-2349
             Project: Struts 2
          Issue Type: Bug
          Components: Core Actions
    Affects Versions: 2.0.11
            Reporter: Sebastian


Locale is set to de_DE.
Action contains a property 

private Double percentage;

with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.

But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 



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


[jira] Issue Comment Edited: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42764 ] 

smittel edited comment on WW-2349 at 12/4/07 1:39 AM:
--------------------------------------------------------

Ok I think have found the cause of this issue. Some XWork developer disabled the localization for Number to String conversion in com.opensymphony.xwork2.util.XWorkBasicConverter, line 76:

<snip>
        if (toType == String.class) {
            /* the code below has been disabled as it causes sideffects in Strtus2 (XW-512)
            // if input (value) is a number then use special conversion method (XW-490)
            Class inputType = value.getClass();
            if (Number.class.isAssignableFrom(inputType)) {
                result = doConvertFromNumberToString(context, value, inputType);
                if (result != null) {
                    return result;
                }
            }*/
            // okay use default string conversion
            result = doConvertToString(context, value);
</snip>

Well, it seems that disabling this code also has serious side effects, as it causes the mentioned problem when using a non-English locale.

      was (Author: smittel):
    Ok maybe I have found the cause of this issue. Some developer disabled the localization for Number to String conversion in com.opensymphony.xwork2.util.XWorkBasicConverter, line 76:

<snip>
        if (toType == String.class) {
            /* the code below has been disabled as it causes sideffects in Strtus2 (XW-512)
            // if input (value) is a number then use special conversion method (XW-490)
            Class inputType = value.getClass();
            if (Number.class.isAssignableFrom(inputType)) {
                result = doConvertFromNumberToString(context, value, inputType);
                if (result != null) {
                    return result;
                }
            }*/
            // okay use default string conversion
            result = doConvertToString(context, value);
</snip>

Well, it seems that disabling this code also has serious side effects, as it causes the mentioned problem when using a non-English locale.
  
> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Commented: (WW-2349) localized conversion from number to string broken

Posted by "Bernard FRANCIS (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46503#action_46503 ] 

Bernard FRANCIS commented on WW-2349:
-------------------------------------

Hello, 

About formating, we tried this using the 2.1.7  of struts and it works fine, all numbers get formatted using the locale as expected

But we have a special need here : while content are internationalized according to the locale, we would like the number to be formatted always the same way (ie en_US format ',' for thousands and '.' for decimals) no matter what the current language is. 
If we remove the getText(... formating as described in the documentation (http://cwiki.apache.org/confluence/display/WW/Formatting+Dates+and+Numbers) there is no conversion issues with numbers, but they're not formated. 

When we put the formating, and swith, say, to fr locale, the keyed in numbers by the users (using the en_US format) will be considered invalid (as fr locale don't accept '.' for parsing) 

How can we tell the converter to always parse with the en Locale ? 

> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Assignee: Rene Gielen
>             Fix For: 2.1.1
>
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Updated: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian updated WW-2349:
--------------------------

    Component/s:     (was: Core Actions)

> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Commented: (WW-2349) localized conversion from number to string broken

Posted by "Dennis Doubleday (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42830 ] 

Dennis Doubleday commented on WW-2349:
--------------------------------------

I'm not sure if this should be a separate bug or not, but I'd like to add the following information. There is also disparity between the treatment of properties that are of type Double and those that are primitive double. When your property is a primitive double, XWork doesn't even localize parsing. XWorkBasicConverter delegates the conversion up to DefaultTypeConverter, which just uses Double.parseDouble() to do the conversion.


> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Commented: (WW-2349) localized conversion from double to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42765 ] 

Sebastian commented on WW-2349:
-------------------------------

See also http://jira.opensymphony.com/browse/XW-490



> localized conversion from double to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.
> But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 

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


[jira] Issue Comment Edited: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42765 ] 

smittel edited comment on WW-2349 at 12/4/07 2:29 AM:
--------------------------------------------------------

Be sure to look here: http://jira.opensymphony.com/browse/XW-490

The XWork developers are aware of this but see Struts2 developers responsible because they see the view to be resposible for localized formatting. Right now, XWork localizes parsing, but does not localize formatting.

      was (Author: smittel):
    Be sure to look here: http://jira.opensymphony.com/browse/XW-490

The XWork developers are aware of this but see Struts2 developers responsible because they see the "view" to be resposible for localized formatting. Right now, XWork localizes parsing, but does not localize formatting.
  
> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Issue Comment Edited: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42765 ] 

smittel edited comment on WW-2349 at 12/4/07 1:33 AM:
--------------------------------------------------------

Look here, strong related to this problem: http://jira.opensymphony.com/browse/XW-490



      was (Author: smittel):
    See also http://jira.opensymphony.com/browse/XW-490


  
> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.
> But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Commented: (WW-2349) localized conversion from double to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42762 ] 

Sebastian commented on WW-2349:
-------------------------------

Addendum: I used a JSP with the JSP textfield tag.

> localized conversion from double to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.
> But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 

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


[jira] Assigned: (WW-2349) localized conversion from number to string broken

Posted by "Rene Gielen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rene Gielen reassigned WW-2349:
-------------------------------

    Assignee: Rene Gielen

> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Assignee: Rene Gielen
>            Priority: Blocker
>             Fix For: Future
>
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Updated: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian updated WW-2349:
--------------------------

    Description: 
Situation:

Locale is set to de_DE.
Action contains a property 

private Double percentage;

with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.

But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 

In short: parsing of numbers is localized, formatting not. This is inconsistent.



  was:
Locale is set to de_DE.
Action contains a property 

private Double percentage;

with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.

But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 

In short: parsing of numbers is localized, formatting not. This is inconsistent.




> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Issue Comment Edited: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42765 ] 

smittel edited comment on WW-2349 at 12/4/07 1:45 AM:
--------------------------------------------------------

Be sure to look here: http://jira.opensymphony.com/browse/XW-490

The XWork developers are aware of this but see Struts2 developers responsible because they see the "view" to be resposible for localized formatting.

      was (Author: smittel):
    Look here, strong related to this problem: http://jira.opensymphony.com/browse/XW-490


  
> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Commented: (WW-2349) localized conversion from number to string broken

Posted by "Dennis Doubleday (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43141#action_43141 ] 

Dennis Doubleday commented on WW-2349:
--------------------------------------

At Rene's suggestion, I created a separate XWork bug that addresses my comment above about double/Double differences:

http://jira.opensymphony.com/browse/XW-606

> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Assignee: Rene Gielen
>             Fix For: 2.1.1
>
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Updated: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian updated WW-2349:
--------------------------

    Priority: Blocker  (was: Major)

> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.
> But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Commented: (WW-2349) localized conversion from double to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42764 ] 

Sebastian commented on WW-2349:
-------------------------------

Ok maybe I have found the cause of this issue. Some developer disabled the localization for Number to String conversion in com.opensymphony.xwork2.util.XWorkBasicConverter, line 76:

<snip>
        if (toType == String.class) {
            /* the code below has been disabled as it causes sideffects in Strtus2 (XW-512)
            // if input (value) is a number then use special conversion method (XW-490)
            Class inputType = value.getClass();
            if (Number.class.isAssignableFrom(inputType)) {
                result = doConvertFromNumberToString(context, value, inputType);
                if (result != null) {
                    return result;
                }
            }*/
            // okay use default string conversion
            result = doConvertToString(context, value);
</snip>

Well, it seems that disabling this code also has serious side effects, as it causes the mentioned problem when using a non-English locale.

> localized conversion from double to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.
> But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 

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


[jira] Updated: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian updated WW-2349:
--------------------------

    Description: 
Locale is set to de_DE.
Action contains a property 

private Double percentage;

with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.

But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 

In short: parsing of numbers is localized, formatting not. This is inconsistent.



  was:
Locale is set to de_DE.
Action contains a property 

private Double percentage;

with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.

But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 



        Summary: localized conversion from number to string broken  (was: localized conversion from double to string broken)

> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale. This is fine and ok.
> But when I preset the Double property to a certain value and render the page afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Issue Comment Edited: (WW-2349) localized conversion from number to string broken

Posted by "Bernard FRANCIS (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46503#action_46503 ] 

Bernard FRANCIS edited comment on WW-2349 at 7/24/09 5:31 AM:
--------------------------------------------------------------

Hello, 

About formating, we tried this using the 2.1.7  of struts and it works fine, all numbers get formatted using the locale as expected

But we have a special need here : while content are internationalized according to the locale, we would like the number to be formatted always the same way (ie en_US format ',' for thousands and '.' for decimals) no matter what the current language is. 
If we remove the getText(... formating as described in the documentation (http://cwiki.apache.org/confluence/display/WW/Formatting+Dates+and+Numbers) there is no conversion issues with numbers, but they're not formated. 

When we put the formating, and swith, say, to fr locale, the keyed in numbers by the users (using the en_US format) will be considered invalid (as fr locale don't accept '.' for parsing) 

How can we tell the converter to always parse with the en_US Locale ? 

      was (Author: augrhlp):
    Hello, 

About formating, we tried this using the 2.1.7  of struts and it works fine, all numbers get formatted using the locale as expected

But we have a special need here : while content are internationalized according to the locale, we would like the number to be formatted always the same way (ie en_US format ',' for thousands and '.' for decimals) no matter what the current language is. 
If we remove the getText(... formating as described in the documentation (http://cwiki.apache.org/confluence/display/WW/Formatting+Dates+and+Numbers) there is no conversion issues with numbers, but they're not formated. 

When we put the formating, and swith, say, to fr locale, the keyed in numbers by the users (using the en_US format) will be considered invalid (as fr locale don't accept '.' for parsing) 

How can we tell the converter to always parse with the en Locale ? 
  
> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Assignee: Rene Gielen
>             Fix For: 2.1.1
>
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Updated: (WW-2349) localized conversion from number to string broken

Posted by "Rene Gielen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rene Gielen updated WW-2349:
----------------------------

      Component/s: Documentation
         Priority: Major  (was: Blocker)
    Fix Version/s:     (was: Future)
                   2.1.1

There is no bug, just a lack of documentation. I'm going to fix that, and will point out that resource here.

> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Assignee: Rene Gielen
>             Fix For: 2.1.1
>
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Issue Comment Edited: (WW-2349) localized conversion from number to string broken

Posted by "Bernard FRANCIS (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46503#action_46503 ] 

Bernard FRANCIS edited comment on WW-2349 at 7/24/09 7:41 AM:
--------------------------------------------------------------

Hello, 

About formating, we tried this using the 2.1.7  of struts and it works fine, all numbers get formatted using the locale as expected

But we have a special need here : while content are internationalized according to the locale, we would like the number to be formatted always the same way (ie en_US format ',' for thousands and '.' for decimals) no matter what the current language is. 
If we remove the getText(... formating as described in the documentation (http://cwiki.apache.org/confluence/display/WW/Formatting+Dates+and+Numbers) there is no conversion issues with numbers, but they're not formated. 

When we put the formating, and switch, say, to the fr locale, the keyed in numbers by the users (using the en_US format) will be considered invalid (as fr locale don't accept '.' for parsing) 

How can we tell the converter to always parse with the en_US Locale ? 

      was (Author: augrhlp):
    Hello, 

About formating, we tried this using the 2.1.7  of struts and it works fine, all numbers get formatted using the locale as expected

But we have a special need here : while content are internationalized according to the locale, we would like the number to be formatted always the same way (ie en_US format ',' for thousands and '.' for decimals) no matter what the current language is. 
If we remove the getText(... formating as described in the documentation (http://cwiki.apache.org/confluence/display/WW/Formatting+Dates+and+Numbers) there is no conversion issues with numbers, but they're not formated. 

When we put the formating, and swith, say, to fr locale, the keyed in numbers by the users (using the en_US format) will be considered invalid (as fr locale don't accept '.' for parsing) 

How can we tell the converter to always parse with the en_US Locale ? 
  
> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Assignee: Rene Gielen
>             Fix For: 2.1.1
>
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Issue Comment Edited: (WW-2349) localized conversion from number to string broken

Posted by "Sebastian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42765 ] 

smittel edited comment on WW-2349 at 12/4/07 1:52 AM:
--------------------------------------------------------

Be sure to look here: http://jira.opensymphony.com/browse/XW-490

The XWork developers are aware of this but see Struts2 developers responsible because they see the "view" to be resposible for localized formatting. Right now, XWork localizes parsing, but does not localize formatting.

      was (Author: smittel):
    Be sure to look here: http://jira.opensymphony.com/browse/XW-490

The XWork developers are aware of this but see Struts2 developers responsible because they see the "view" to be resposible for localized formatting.
  
> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Priority: Blocker
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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


[jira] Resolved: (WW-2349) localized conversion from number to string broken

Posted by "Rene Gielen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rene Gielen resolved WW-2349.
-----------------------------

    Resolution: Fixed

See the newly added documentation here:
http://cwiki.apache.org/confluence/display/WW/Formatting+Dates+and+Numbers


> localized conversion from number to string broken
> -------------------------------------------------
>
>                 Key: WW-2349
>                 URL: https://issues.apache.org/struts/browse/WW-2349
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 2.0.11
>            Reporter: Sebastian
>            Assignee: Rene Gielen
>             Fix For: 2.1.1
>
>
> Situation:
> Locale is set to de_DE.
> Action contains a property 
> private Double percentage;
> with getters/setters.  The corresponding page contains a "textfield" tag for this property. It only accepts a "," (comma) as a decimal separator due to the set locale.
> But when the Double property is preset to a certain value and the page rendered afterwards, the textfield is filled with a number using the "." (dot) as decimal separator, instead of comma. 
> In short: parsing of numbers is localized, formatting not. This is inconsistent.

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