on 10.6 use localizedStringFromDate:dateStyle:timeStyle: for formatting the blocklist update date

This commit is contained in:
Mitchell Livingston 2009-08-30 19:23:20 +00:00
parent 9206b7e107
commit abe1206e6e
1 changed files with 13 additions and 6 deletions

View File

@ -27,6 +27,7 @@
#import "BlocklistScheduler.h"
#import "PortChecker.h"
#import "BonjourController.h"
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h"
#import "UKKQueue.h"
#import "utils.h"
@ -524,12 +525,18 @@ tr_session * fHandle;
NSDate * updatedDate = [fDefaults objectForKey: @"BlocklistLastUpdate"];
if (updatedDate)
{
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
updatedDateString = [dateFormatter stringFromDate: updatedDate];
[dateFormatter release];
if ([NSApp isOnSnowLeopardOrBetter])
updatedDateString = [NSDateFormatter localizedStringFromDate: updatedDate dateStyle: NSDateFormatterFullStyle
timeStyle: NSDateFormatterShortStyle];
else
{
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle: NSDateFormatterFullStyle];
[dateFormatter setTimeStyle: NSDateFormatterShortStyle];
updatedDateString = [dateFormatter stringFromDate: updatedDate];
[dateFormatter release];
}
}
else
updatedDateString = NSLocalizedString(@"N/A", "Prefs -> blocklist -> message");