mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Use NSNumberFormatter class method
Once we drop 10.7 support we can avoid NSNumberFormatter entirely by using ‘localizedStringWithFormat:’ with ‘%lu’.
This commit is contained in:
@@ -415,13 +415,9 @@ NSString* const FFFindWasTriggeredByEnter = @"FFFindWasTriggeredByEnter";
|
||||
default: fmt = MSG_MULTIPLE_MATCHES_FMT; break;
|
||||
}
|
||||
|
||||
NSNumberFormatter* formatter = [NSNumberFormatter new]; // FIXME we want to cache this as it is expensive
|
||||
[formatter setPositiveFormat:@"#,##0"];
|
||||
[formatter setLocalizesFormat:YES];
|
||||
|
||||
NSString* msg = [NSString localizedStringWithFormat:fmt, [_documentSearch searchString], [formatter stringFromNumber:@(totalMatches)]];
|
||||
NSString* msg = [NSString stringWithFormat:fmt, [_documentSearch searchString], [NSNumberFormatter localizedStringFromNumber:@(totalMatches) numberStyle:NSNumberFormatterDecimalStyle]];
|
||||
if(!_documentSearch.documentIdentifier)
|
||||
msg = [msg stringByAppendingFormat:([_documentSearch scannedFileCount] == 1 ? MSG_SEARCHED_FILES_ONE : MSG_SEARCHED_FILES_MULTIPLE), [formatter stringFromNumber:@([_documentSearch scannedFileCount])], [_documentSearch searchDuration]];
|
||||
msg = [msg stringByAppendingFormat:([_documentSearch scannedFileCount] == 1 ? MSG_SEARCHED_FILES_ONE : MSG_SEARCHED_FILES_MULTIPLE), [NSNumberFormatter localizedStringFromNumber:@([_documentSearch scannedFileCount]) numberStyle:NSNumberFormatterDecimalStyle], [_documentSearch searchDuration]];
|
||||
|
||||
self.windowController.statusString = msg;
|
||||
}
|
||||
|
||||
@@ -631,15 +631,7 @@ inline void rank_record (document_record_t& record, filter_string_t const& filte
|
||||
|
||||
[self updateStatusText:self];
|
||||
|
||||
NSNumberFormatter* formatter = [NSNumberFormatter new];
|
||||
[formatter setPositiveFormat:@"#,##0"];
|
||||
[formatter setLocalizesFormat:YES];
|
||||
|
||||
NSString* count = [formatter stringFromNumber:@(_items.count)];
|
||||
if(_items.count == 1)
|
||||
count = [count stringByAppendingString:@" item"];
|
||||
else count = [count stringByAppendingString:@" items"];
|
||||
_itemCountTextField.stringValue = count;
|
||||
_itemCountTextField.stringValue = [NSString stringWithFormat:@"%@ item%s", [NSNumberFormatter localizedStringFromNumber:@(_items.count) numberStyle:NSNumberFormatterDecimalStyle], _items.count == 1 ? "" : "s"];
|
||||
}
|
||||
|
||||
- (void)updateSCMStatus
|
||||
|
||||
Reference in New Issue
Block a user