You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org> on 2010/11/09 22:22:23 UTC

[jira] Created: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
----------------------------------------------------------------------------------------------------

                 Key: TRINIDAD-1958
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 1.2.13-core 
            Reporter: Yee-Wah Lee
            Priority: Minor


1. Use the following jspx, binding the value of the inputText to a positive integer. 
  <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
          <tr:convertNumber type="currency" locale="ar_SA"/> 
          </tr:inputText>
          <tr:outputText value="Value submitted is #{clientValidation.integer}"/>

2. Run the jspx, it displays something like:
2ر.س.‏ 0

3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
Enter a currency in the same format as this example: ر.س.‏ 10,250

-- 
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: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Hazem Saleh (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930344#action_12930344 ] 

Hazem Saleh edited comment on TRINIDAD-1958 at 11/9/10 6:16 PM:
----------------------------------------------------------------

>> Need to confirm if the Arabic symbols for negative pre/suffix are indeed correct. 

>> That is, if I want to represent the value -9 in currency, this is correct: 
>> en_US: ($9) 
>> he_IL: -9 ?? 
>>ar_SA: 9 ?? - 

No, this is incorrect. For Arabic currency, it is represented as "-9 ??".

Like for example:
-9 رس
-9 جم
and so on.

But the following is invalid to say:
9 رس -
or
9 جم -



      was (Author: hazems):
    >> Need to confirm if the Arabic symbols for negative pre/suffix are indeed correct. 

>> That is, if I want to represent the value -9 in currency, this is correct: 
>> en_US: ($9) 
>> he_IL: -9 ?? 
>>ar_SA: 9 ?? - 

No, this is incorrect. For Arabic currency, it is represented as (-9 ??).

Like for example:
-9 رس
-9 جم
and so on.


  
> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

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


[jira] Commented: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930357#action_12930357 ] 

Yee-Wah Lee commented on TRINIDAD-1958:
---------------------------------------

Thanks Hazem for the confirmation! 

This bug is then a JDK issue, since we use JDK's DecimalFormatSymbols for generating the currency data. 

> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

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


[jira] Commented: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930308#action_12930308 ] 

Yee-Wah Lee commented on TRINIDAD-1958:
---------------------------------------

The CurrencyElements in the JS file is generated by maven-i18n-plugin which uses DecimalFormatSymbols#getCurrencySymbol(), getCurrencyCode(), etc. 
JSLocaleElementsGenerator.java#_getCurrencyData
    DecimalFormat df = (DecimalFormat)   NumberFormat.getCurrencyInstance(targetLocale);
    DecimalFormatSymbols decimalFormatSymbols = df.getDecimalFormatSymbols();
    Object[] currencyData = new Object[6];
    currencyData[0] = decimalFormatSymbols.getCurrencySymbol();
    currencyData[1] = decimalFormatSymbols.getCurrency().getCurrencyCode();
    currencyData[2] = df.getPositivePrefix();
    currencyData[3] = df.getPositiveSuffix();
    currencyData[4] = df.getNegativePrefix();
    currencyData[5] = df.getNegativeSuffix();
..

Tried using native Arabic Windows box, and in the regional setting dialog, the currency format is same as JDK's format value.


> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

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


[jira] Resolved: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Gabrielle Crawford (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gabrielle Crawford resolved TRINIDAD-1958.
------------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0-beta-2
         Assignee: Gabrielle Crawford

> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Assignee: Gabrielle Crawford
>            Priority: Minor
>             Fix For: 2.0.0-beta-2
>
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Commented: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930307#action_12930307 ] 

Yee-Wah Lee commented on TRINIDAD-1958:
---------------------------------------

Need to confirm if the Arabic symbols for negative pre/suffix are indeed correct. 

That is, if I want to represent the value -9 in currency, this is correct:
en_US: ($9)
he_IL: -9 ??
ar_IW:  9 ?? -
where ?? are the currency symbols for the respective languages.

If the above is correct, although Hebrew and Arabic are both BiDi languages they represent negative numbers differently (pre vs suffix) and the code would indeed need to change.


> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

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


[jira] Commented: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Hazem Saleh (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930344#action_12930344 ] 

Hazem Saleh commented on TRINIDAD-1958:
---------------------------------------

>> Need to confirm if the Arabic symbols for negative pre/suffix are indeed correct. 

>> That is, if I want to represent the value -9 in currency, this is correct: 
>> en_US: ($9) 
>> he_IL: -9 ?? 
>>ar_SA: 9 ?? - 

No, this is incorrect. For Arabic currency, it is represented as (-9 ??).

Like for example:
-9 رس
-9 جم
and so on.



> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

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


[jira] Commented: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12992169#comment-12992169 ] 

Yee-Wah Lee commented on TRINIDAD-1958:
---------------------------------------

Modified the stringToCurrency method in NumberFormat to check or both negative prefix and suffix before going into the negative case. That seems to be sufficient for the issue.

> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Commented: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12992155#comment-12992155 ] 

Yee-Wah Lee commented on TRINIDAD-1958:
---------------------------------------

There is a JDK bug 6871307
http://monaco.sfbay.sun.com/detail.jsf?cr=6871307

But it was also pointed out that Windows uses the same format that JDK does, and that either format might be acceptable. 

> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Issue Comment Edited: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930307#action_12930307 ] 

Yee-Wah Lee edited comment on TRINIDAD-1958 at 11/9/10 5:01 PM:
----------------------------------------------------------------

Need to confirm if the Arabic symbols for negative pre/suffix are indeed correct. 

That is, if I want to represent the value -9 in currency, this is correct:
en_US: ($9)
he_IL: -9 ??
ar_SA:  9 ?? -
where ?? are the currency symbols for the respective languages.

If the above is correct, although Hebrew and Arabic are both BiDi languages they represent negative numbers differently (pre vs suffix) and the code would indeed need to change.


      was (Author: yeelee):
    Need to confirm if the Arabic symbols for negative pre/suffix are indeed correct. 

That is, if I want to represent the value -9 in currency, this is correct:
en_US: ($9)
he_IL: -9 ??
ar_IW:  9 ?? -
where ?? are the currency symbols for the respective languages.

If the above is correct, although Hebrew and Arabic are both BiDi languages they represent negative numbers differently (pre vs suffix) and the code would indeed need to change.

  
> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

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


[jira] Commented: (TRINIDAD-1958) Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930301#action_12930301 ] 

Yee-Wah Lee commented on TRINIDAD-1958:
---------------------------------------

The locale files define the currency data using prefix and suffix for the currency, e.g. in the localeElements_en_US.js defines
CurrencyElements:["\xa4", "XXX", "\xa4", "", "-\xa4", ""], 

which is interpreted as [Currency Symbol, Currency Code, Positive Prefix, Positive Suffix, Negative Prefix, Negative Suffix]. See Locale.js#_getCurrency*. 

The following is currency data for some locales:
en_US:
positive prefix: $
positive suffix: "", empty string
negative prefix: ($
negative suffix:  )

For Hebrew (he_IL):
positive prefix: "", empty string
positive suffix: \u05e9\x22\u05d7
negative prefix: -
negative suffix: \u05e9\x22\u05d7

Arabic (ar_SA),  note the values for negative prefix and negative suffix
positive prefix:  \u0631.\u0633.\u200f
positive suffix:  "", empty string
negative prefix:  \u0631.\u0633.\u200f
negative suffix:  -

The client number converter assumes the negative prefix is in the front,and tests for that first. In the arabic case, the locale files define negative prefix the same as positive prefix so it goes into the first clause which additionally searches for the  negative suffix. Failing to find that, it throws a ParseException. 
TrNumberFormat.prototype.stringToCurrency = function(numberString)
{
  //is the string negative ?
  var negP = numberString.indexOf(this._nPre);
  
  if(negP != -1)
  {
    numberString = numberString.substr(this._nPre.length, numberString.length);
..
    if(negS != -1)
    {
     // parse thev alue
    }
    else
    {
      throw new TrParseException("not able to parse number");
    }
}

> Client tr:numberConverter with type="currency" incorrectly handles arabic locale for positive values
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1958
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1958
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> 1. Use the following jspx, binding the value of the inputText to a positive integer. 
>   <tr:inputText label="InputText Arabic" value="#{clientValidation.integer}" autoSubmit="true">
>           <tr:convertNumber type="currency" locale="ar_SA"/> 
>           </tr:inputText>
>           <tr:outputText value="Value submitted is #{clientValidation.integer}"/>
> 2. Run the jspx, it displays something like:
> 2ر.س.‏ 0
> 3. Modify just the numerical portion of the text and tab off: Get an Incorrect Format error
> Enter a currency in the same format as this example: ر.س.‏ 10,250

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