10.8 リリース ノートに多少記載されています。
NSString ローカライズされたフォーマット
10.8 では、10.8 SDK にリンクされたアプリで、-localizedStringWithFormat:、および -initWithFormat:locale: (およびその仲間) が nil 以外のロケールで提供されると、数値のローカライズされた書式設定を行うようになりました。以前は、これらの呼び出しはすでに小数点処理を行っていました。そのため、一部のロケールでは、小数点区切り記号にコンマが使用されます。この新しい動作はこれに基づいて構築され、ローカライズされた数字、桁区切り記号、および記号記号の適切な配置を使用します。
しかし、私はまだそれをバグだと考えています (そしてファイルに入れました)、多くの問題があります (レガシー UI のねじ込み、手で編集したときの時々の間違った動作など)。
新しい UI では、数値を表示するすべてのテキスト フィールドに使用する数値フォーマッタを nib に追加するのがおそらく最善です。
(私の場合のように)さらに多くのテキストフィールドを持つ多くの nib ファイルがある場合、この醜いハックが役立つかもしれません:
#import "HHUTextFieldCell.h"
@implementation HHUTextFieldCell //:: NSTextFieldCell
//*****************************************************************************
// Class methods
//*****************************************************************************
+ (void)load {
//
// 10.8 started using thousands separators for text fields. For our legacy
// apps we don't want those. Rather than changing dozens of xib files with
// hundreds of text fields, we use a replacement class to modify the text
// fields to not have a thousands separator.
//
[NSKeyedUnarchiver setClass:[HHUTextFieldCell class] forClassName:@"NSTextFieldCell"];
}
//*****************************************************************************
// Overwritten methods
//*****************************************************************************
- (void)setObjectValue:(id < NSCopying >)object {
//
// If `object` is an NSNumber object and no formatter is set, we instead
// set the description of that number via -setStringValue:. Otherwise
// use the original implementation.
//
if(!self.formatter && [(NSObject *)object isKindOfClass:[NSNumber class]])
{
[super setStringValue:[(NSObject *)object description]];
}
else
{
[super setObjectValue:object];
}
}
@end