You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Chris Martin (JIRA)" <ji...@apache.org> on 2015/06/09 07:13:00 UTC

[jira] [Updated] (FLEX-34878) error property of NumberFormatter returns null and not it's default value

     [ https://issues.apache.org/jira/browse/FLEX-34878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Martin updated FLEX-34878:
--------------------------------
    Description: 
Steps to reproduce:

Build an application from the following code:
{code:actionscript}
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCC();">
    <mx:Script>
    <![CDATA[
        import mx.formatters.NumberFormatter;

        private function onCC():void
        {
            var nf:NumberFormatter = new NumberFormatter();
            nf.precision = 2;
            resourceManager.localeChain = ['zh-Hans'];
            trace("number:"+nf.format(1/3));
            trace("error: " + nf.error);
        } 
    ]]>
    </mx:Script>
</mx:WindowedApplication>
{code}

Compile the application but do not compile in a locale resource set for zh-Hans. Only compile in 'en_US'.

Test the application and note that the first trace statement will return blank and the second trace statement of the error property returns null.

Because the zh-Hans locale was not compiled in we are unable to know what language to use to display the default error message of "Invalid format".

Would like to add in a comment into the asdocs informing the user that if none of the locales in the localeChain property of the ResourceManager are not compiled in, then it will return null.

  was:
Steps to reproduce:

Build an application from the following code:
{code:actionscript}
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCC();">
    <mx:Script>
    <![CDATA[
        import mx.formatters.NumberFormatter;

        private function onCC():void
        {
            var nf:NumberFormatter = new NumberFormatter();
            nf.precision = 2;
            resourceManager.localeChain = ['zh-Hans'];
            trace("number:"+nf.format(1/3));
            trace("error: " + nf.error);
        } 
    ]]>
    </mx:Script>
</mx:WindowedApplication>
{code}

Compile the application but do not compile in a locale resource set for zh-Hans. Only compile in 'en_US'.

Test the application and note that the first trace statement will return blank and the second trace statement of the error property returns null.

Because the zh-Hans locale was not compiled in we are unable to know what language to use to display the default error message of "Invalid format".

Would like to add in a comment into the asdocs informing using that the error property cannot return the default values in the requested locale has not been compiled in.



> error property of NumberFormatter returns null and not it's default value
> -------------------------------------------------------------------------
>
>                 Key: FLEX-34878
>                 URL: https://issues.apache.org/jira/browse/FLEX-34878
>             Project: Apache Flex
>          Issue Type: Improvement
>            Reporter: Chris Martin
>            Assignee: Chris Martin
>            Priority: Trivial
>
> Steps to reproduce:
> Build an application from the following code:
> {code:actionscript}
> <?xml version="1.0" encoding="utf-8"?>
> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCC();">
>     <mx:Script>
>     <![CDATA[
>         import mx.formatters.NumberFormatter;
>         private function onCC():void
>         {
>             var nf:NumberFormatter = new NumberFormatter();
>             nf.precision = 2;
>             resourceManager.localeChain = ['zh-Hans'];
>             trace("number:"+nf.format(1/3));
>             trace("error: " + nf.error);
>         } 
>     ]]>
>     </mx:Script>
> </mx:WindowedApplication>
> {code}
> Compile the application but do not compile in a locale resource set for zh-Hans. Only compile in 'en_US'.
> Test the application and note that the first trace statement will return blank and the second trace statement of the error property returns null.
> Because the zh-Hans locale was not compiled in we are unable to know what language to use to display the default error message of "Invalid format".
> Would like to add in a comment into the asdocs informing the user that if none of the locales in the localeChain property of the ResourceManager are not compiled in, then it will return null.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)