It recently occurred to me that using the NSNumberFormatter installed for "OS X 10.0 Behavior" may no longer be in vogue. Therefore, I changed the number of formatter attached to multiple NSTextFields to "10.4 default behavior" and decimal style.Everything works fine, except that the number of the formatter no longer automatically localizes its decimal separator after switching from US (.) To German (,). I seem to be stuck with what was the active decimal separator when creating the number format in IB.
The βlocalizeβ checkbox in IB does not have an effect, as expected, because setLocalizesFormat: is documented to work only for formatters in the 10.0 style (leaving me wondering why the checkbox is even there).
In my workaround, the custom subclass NSNumberFormatter is now configured in IB as follows:
- (void) awakeFromNib
{
self.decimalSeparator = [[NSLocale currentLocale] objectForKey:NSLocaleDecimalSeparator];
}
I canβt believe that the correct way to do it, like formatting 10.0 style, did not have this problem.
Any ideas what I am missing?
Regards, Ilja
source
share