Localized number formatting

  • I am trying to use the formatter in IB, formatting according to our
    norwegian format. I attach the NSNumberFormatter to an NSTextField,
    and click on the row with a $ and two decimal places.
    I now click on "Localize", and gets this:  kr #,##0.00

    It doesn't look right in the sample field. In norwegian format, we
    use a space as a 1000 separator, and comma for separating the digits
    and decimal digits. If I type 1064, I want to have it formatted to
    "kr 1 064,00". But if I try to type that into the field, I get a
    console message:

    2005-07-26 16:09:02.169 Partos[2699] *** -[NSCFDictionary
    setObject:forKey:]: attempt to insert nil value

    If I try to type a number under 1000, it gets formatted OK (500 is
    formatted as "kr 500,00").

    Is this a bug in Cocoa? I am using XCode 2.0, but also had the same
    behaviour in earlier versions.

    Ivan
  • On 26. jul. 2005, at 09.13, Ivan C Myrvold wrote:

    > I am trying to use the formatter in IB, formatting according to our
    > norwegian format. I attach the NSNumberFormatter to an NSTextField,
    > and click on the row with a $ and two decimal places.
    > I now click on "Localize", and gets this:  kr #,##0.00
    >
    > It doesn't look right in the sample field. In norwegian format, we
    > use a space as a 1000 separator, and comma for separating the
    > digits and decimal digits. If I type 1064, I want to have it
    > formatted to "kr 1 064,00". But if I try to type that into the
    > field, I get a console message:

    Don't worry about the sample field. Just run the app, it should look
    fine. I just tried it and it worked as you expected it to.
    > 2005-07-26 16:09:02.169 Partos[2699] *** -[NSCFDictionary
    > setObject:forKey:]: attempt to insert nil value
    >
    >
    > If I try to type a number under 1000, it gets formatted OK (500 is
    > formatted as "kr 500,00").
    >
    > Is this a bug in Cocoa? I am using XCode 2.0, but also had the same
    > behaviour in earlier versions.
    >
    > Ivan
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/skiadas%
    > 40math.uchicago.edu
    >
    > This email sent to <skiadas...>
    >

    Haris
  • But it doesn't. Sorry for the confusion, but what I wrote in my first
    post was what happened in my compiled application. In my case, every
    time I puch in a number greater than 1000, the text field is blanked
    out, and the console message about attempting to insert nil value is
    written to the console. Weird.

    Ivan

    Den 26. jul. 2005 kl. 17:54 skrev Charilaos Skiadas:

    > On 26. jul. 2005, at 09.13, Ivan C Myrvold wrote:
    >
    >> I am trying to use the formatter in IB, formatting according to
    >> our norwegian format. I attach the NSNumberFormatter to an
    >> NSTextField, and click on the row with a $ and two decimal places.
    >> I now click on "Localize", and gets this:  kr #,##0.00
    >>
    >> It doesn't look right in the sample field. In norwegian format, we
    >> use a space as a 1000 separator, and comma for separating the
    >> digits and decimal digits. If I type 1064, I want to have it
    >> formatted to "kr 1 064,00". But if I try to type that into the
    >> field, I get a console message:
    >
    > Don't worry about the sample field. Just run the app, it should
    > look fine. I just tried it and it worked as you expected it to.
    >> 2005-07-26 16:09:02.169 Partos[2699] *** -[NSCFDictionary
    >> setObject:forKey:]: attempt to insert nil value
    >>
    >>
    >> If I try to type a number under 1000, it gets formatted OK (500 is
    >> formatted as "kr 500,00").
    >>
    >> Is this a bug in Cocoa? I am using XCode 2.0, but also had the
    >> same behaviour in earlier versions.
    >>
    >> Ivan
    >>
    >> _______________________________________________
    >> Do not post admin requests to the list. They will be ignored.
    >> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >> Help/Unsubscribe/Update your Subscription:
    >> http://lists.apple.com/mailman/options/cocoa-dev/skiadas%
    >> 40math.uchicago.edu
    >>
    >> This email sent to <skiadas...>
    >>
    >
    > Haris
    >
    >
  • This is what I tried:
    1)Go to System preferences/international/formats, and set region to
    norway(norwegian nynorsk)
    2)Create new Core Data project. (called it "quick")
    3)Go to the model. and create an entity with an optional decimal
    attribute "numb"
    4)Open MainMenu.nib, and option-drag the entity to create a UI for
    many objects.
    5)Go to the number formatter of the column corresponding to "numb",
    select the second from the top in terms of formatting options, click
    on localize.
    6)Then I run the program. You are quite right, as it is there is a
    problem.
    7)Now, go back to the inspector for the formatter, click the second
    option for formatting again, and then disable and reenable the
    localize option again.
    8)Now, mysteriously it works.

    Sounds to me like a bug in IB, if you can actually reproduce these
    steps.

    On 26. jul. 2005, at 11.21, Ivan C Myrvold wrote:

    > But it doesn't. Sorry for the confusion, but what I wrote in my
    > first post was what happened in my compiled application. In my
    > case, every time I puch in a number greater than 1000, the text
    > field is blanked out, and the console message about attempting to
    > insert nil value is written to the console. Weird.
    >
    > Ivan
    >
    > Den 26. jul. 2005 kl. 17:54 skrev Charilaos Skiadas:
    >
    >> On 26. jul. 2005, at 09.13, Ivan C Myrvold wrote:
    >>
    >>> I am trying to use the formatter in IB, formatting according to
    >>> our norwegian format. I attach the NSNumberFormatter to an
    >>> NSTextField, and click on the row with a $ and two decimal places.
    >>> I now click on "Localize", and gets this:  kr #,##0.00
    >>>
    >>> It doesn't look right in the sample field. In norwegian format,
    >>> we use a space as a 1000 separator, and comma for separating the
    >>> digits and decimal digits. If I type 1064, I want to have it
    >>> formatted to "kr 1 064,00". But if I try to type that into the
    >>> field, I get a console message:
    >>
    >> Don't worry about the sample field. Just run the app, it should
    >> look fine. I just tried it and it worked as you expected it to.
    >>> 2005-07-26 16:09:02.169 Partos[2699] *** -[NSCFDictionary
    >>> setObject:forKey:]: attempt to insert nil value
    >>>
    >>>
    >>> If I try to type a number under 1000, it gets formatted OK (500
    >>> is formatted as "kr 500,00").
    >>>
    >>> Is this a bug in Cocoa? I am using XCode 2.0, but also had the
    >>> same behaviour in earlier versions.
    >>>
    >>> Ivan
    >>>
    >>> _______________________________________________
    >>> Do not post admin requests to the list. They will be ignored.
    >>> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >>> Help/Unsubscribe/Update your Subscription:
    >>> http://lists.apple.com/mailman/options/cocoa-dev/skiadas%
    >>> 40math.uchicago.edu
    >>>
    >>> This email sent to <skiadas...>
    >>>
    >>
    >> Haris
    >>
    >>
    >

    Haris
  • The disable and re-enable action you described in step 7 indeed
    helped. Now, everything works as it should. Thanks a lot!
    I must submit this bug to Apple, and use this workaround until they
    have fixed it.

    Ivan

    Den 26. jul. 2005 kl. 20:54 skrev Charilaos Skiadas:

    > This is what I tried:
    > 1)Go to System preferences/international/formats, and set region to
    > norway(norwegian nynorsk)
    > 2)Create new Core Data project. (called it "quick")
    > 3)Go to the model. and create an entity with an optional decimal
    > attribute "numb"
    > 4)Open MainMenu.nib, and option-drag the entity to create a UI for
    > many objects.
    > 5)Go to the number formatter of the column corresponding to "numb",
    > select the second from the top in terms of formatting options,
    > click on localize.
    > 6)Then I run the program. You are quite right, as it is there is a
    > problem.
    > 7)Now, go back to the inspector for the formatter, click the second
    > option for formatting again, and then disable and reenable the
    > localize option again.
    > 8)Now, mysteriously it works.
    >
    > Sounds to me like a bug in IB, if you can actually reproduce these
    > steps.
    >
    > On 26. jul. 2005, at 11.21, Ivan C Myrvold wrote:
    >
    >> But it doesn't. Sorry for the confusion, but what I wrote in my
    >> first post was what happened in my compiled application. In my
    >> case, every time I puch in a number greater than 1000, the text
    >> field is blanked out, and the console message about attempting to
    >> insert nil value is written to the console. Weird.
    >>
    >> Ivan
    >>
    >> Den 26. jul. 2005 kl. 17:54 skrev Charilaos Skiadas:
    >>
    >>> On 26. jul. 2005, at 09.13, Ivan C Myrvold wrote:
    >>>
    >>>> I am trying to use the formatter in IB, formatting according to
    >>>> our norwegian format. I attach the NSNumberFormatter to an
    >>>> NSTextField, and click on the row with a $ and two decimal places.
    >>>> I now click on "Localize", and gets this:  kr #,##0.00
    >>>>
    >>>> It doesn't look right in the sample field. In norwegian format,
    >>>> we use a space as a 1000 separator, and comma for separating the
    >>>> digits and decimal digits. If I type 1064, I want to have it
    >>>> formatted to "kr 1 064,00". But if I try to type that into the
    >>>> field, I get a console message:
    >>>
    >>> Don't worry about the sample field. Just run the app, it should
    >>> look fine. I just tried it and it worked as you expected it to.
    >>>> 2005-07-26 16:09:02.169 Partos[2699] *** -[NSCFDictionary
    >>>> setObject:forKey:]: attempt to insert nil value
    >>>>
    >>>>
    >>>> If I try to type a number under 1000, it gets formatted OK (500
    >>>> is formatted as "kr 500,00").
    >>>>
    >>>> Is this a bug in Cocoa? I am using XCode 2.0, but also had the
    >>>> same behaviour in earlier versions.
    >>>>
    >>>> Ivan
    >>>>
    >>>> _______________________________________________
    >>>> Do not post admin requests to the list. They will be ignored.
    >>>> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >>>> Help/Unsubscribe/Update your Subscription:
    >>>> http://lists.apple.com/mailman/options/cocoa-dev/skiadas%
    >>>> 40math.uchicago.edu
    >>>>
    >>>> This email sent to <skiadas...>
    >>>>
    >>>
    >>> Haris
    >>>
    >>>
    >>
    >
    > Haris
    >
    >