mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Move default date locale info to NSUserDefaults from NSDate
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3394 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dd5fa90249
commit
52e8c0e26c
2 changed files with 101 additions and 104 deletions
103
Source/NSDate.m
103
Source/NSDate.m
|
@ -86,109 +86,6 @@ findInArray(NSArray *array, unsigned pos, NSString *str)
|
|||
|
||||
static BOOL debug = NO;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSDate class])
|
||||
{
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary *registrationDefaults;
|
||||
NSArray *ampm;
|
||||
NSArray *long_day;
|
||||
NSArray *long_month;
|
||||
NSArray *short_day;
|
||||
NSArray *short_month;
|
||||
NSArray *earlyt;
|
||||
NSArray *latert;
|
||||
NSArray *hour_names;
|
||||
NSArray *ymw_names;
|
||||
|
||||
ampm = [NSArray arrayWithObjects: @"AM", @"PM", nil];
|
||||
short_month = [NSArray arrayWithObjects:
|
||||
@"Jan",
|
||||
@"Feb",
|
||||
@"Mar",
|
||||
@"Apr",
|
||||
@"May",
|
||||
@"Jun",
|
||||
@"Jul",
|
||||
@"Aug",
|
||||
@"Sep",
|
||||
@"Oct",
|
||||
@"Nov",
|
||||
@"Dec",
|
||||
nil];
|
||||
long_month = [NSArray arrayWithObjects:
|
||||
@"January",
|
||||
@"February",
|
||||
@"March",
|
||||
@"April",
|
||||
@"May",
|
||||
@"June",
|
||||
@"July",
|
||||
@"August",
|
||||
@"September",
|
||||
@"October",
|
||||
@"November",
|
||||
@"December",
|
||||
nil];
|
||||
short_day = [NSArray arrayWithObjects:
|
||||
@"Sun",
|
||||
@"Mon",
|
||||
@"Tue",
|
||||
@"Wed",
|
||||
@"Thu",
|
||||
@"Fri",
|
||||
@"Sat",
|
||||
nil];
|
||||
long_day = [NSArray arrayWithObjects:
|
||||
@"Sunday",
|
||||
@"Monday",
|
||||
@"Tuesday",
|
||||
@"Wednesday",
|
||||
@"Thursday",
|
||||
@"Friday",
|
||||
@"Saturday",
|
||||
nil];
|
||||
earlyt = [NSArray arrayWithObjects:
|
||||
@"prior",
|
||||
@"last",
|
||||
@"past",
|
||||
@"ago",
|
||||
nil];
|
||||
latert = [NSArray arrayWithObjects:
|
||||
@"next",
|
||||
nil];
|
||||
ymw_names = [NSArray arrayWithObjects:
|
||||
@"year",
|
||||
@"month",
|
||||
@"week",
|
||||
nil];
|
||||
hour_names = [NSArray arrayWithObjects:
|
||||
[NSArray arrayWithObjects: @"0", @"midnight", nil],
|
||||
[NSArray arrayWithObjects: @"12", @"noon", @"lunch", nil],
|
||||
[NSArray arrayWithObjects: @"10", @"morning", nil],
|
||||
[NSArray arrayWithObjects: @"14", @"afternoon", nil],
|
||||
[NSArray arrayWithObjects: @"19", @"dinner", nil],
|
||||
nil];
|
||||
registrationDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
ampm, NSAMPMDesignation,
|
||||
long_month, NSMonthNameArray,
|
||||
long_day, NSWeekDayNameArray,
|
||||
short_month, NSShortMonthNameArray,
|
||||
short_day, NSShortWeekDayNameArray,
|
||||
@"DMYH", NSDateTimeOrdering,
|
||||
@"tomorrow", NSNextDayDesignations,
|
||||
@"nextday", NSNextNextDayDesignations,
|
||||
@"yesterday", NSPriorDayDesignations,
|
||||
@"today", NSThisDayDesignations,
|
||||
earlyt, NSEarlierTimeDesignations,
|
||||
latert, NSLaterTimeDesignations,
|
||||
hour_names, NSHourNameDesignations,
|
||||
ymw_names, NSYearMonthWeekDesignations,
|
||||
nil];
|
||||
[defs registerDefaults: registrationDefaults];
|
||||
}
|
||||
}
|
||||
// Getting current time
|
||||
|
||||
+ (NSTimeInterval) timeIntervalSinceReferenceDate
|
||||
|
|
|
@ -94,7 +94,107 @@ static NSMutableString *processName = nil;
|
|||
sharedDefaults = [[self alloc] init];
|
||||
|
||||
[sharedDefaults __createStandardSearchList];
|
||||
|
||||
|
||||
{
|
||||
NSUserDefaults *defs;
|
||||
NSDictionary *registrationDefaults;
|
||||
NSArray *ampm;
|
||||
NSArray *long_day;
|
||||
NSArray *long_month;
|
||||
NSArray *short_day;
|
||||
NSArray *short_month;
|
||||
NSArray *earlyt;
|
||||
NSArray *latert;
|
||||
NSArray *hour_names;
|
||||
NSArray *ymw_names;
|
||||
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
ampm = [NSArray arrayWithObjects: @"AM", @"PM", nil];
|
||||
short_month = [NSArray arrayWithObjects:
|
||||
@"Jan",
|
||||
@"Feb",
|
||||
@"Mar",
|
||||
@"Apr",
|
||||
@"May",
|
||||
@"Jun",
|
||||
@"Jul",
|
||||
@"Aug",
|
||||
@"Sep",
|
||||
@"Oct",
|
||||
@"Nov",
|
||||
@"Dec",
|
||||
nil];
|
||||
long_month = [NSArray arrayWithObjects:
|
||||
@"January",
|
||||
@"February",
|
||||
@"March",
|
||||
@"April",
|
||||
@"May",
|
||||
@"June",
|
||||
@"July",
|
||||
@"August",
|
||||
@"September",
|
||||
@"October",
|
||||
@"November",
|
||||
@"December",
|
||||
nil];
|
||||
short_day = [NSArray arrayWithObjects:
|
||||
@"Sun",
|
||||
@"Mon",
|
||||
@"Tue",
|
||||
@"Wed",
|
||||
@"Thu",
|
||||
@"Fri",
|
||||
@"Sat",
|
||||
nil];
|
||||
long_day = [NSArray arrayWithObjects:
|
||||
@"Sunday",
|
||||
@"Monday",
|
||||
@"Tuesday",
|
||||
@"Wednesday",
|
||||
@"Thursday",
|
||||
@"Friday",
|
||||
@"Saturday",
|
||||
nil];
|
||||
earlyt = [NSArray arrayWithObjects:
|
||||
@"prior",
|
||||
@"last",
|
||||
@"past",
|
||||
@"ago",
|
||||
nil];
|
||||
latert = [NSArray arrayWithObjects:
|
||||
@"next",
|
||||
nil];
|
||||
ymw_names = [NSArray arrayWithObjects:
|
||||
@"year",
|
||||
@"month",
|
||||
@"week",
|
||||
nil];
|
||||
hour_names = [NSArray arrayWithObjects:
|
||||
[NSArray arrayWithObjects: @"0", @"midnight", nil],
|
||||
[NSArray arrayWithObjects: @"12", @"noon", @"lunch", nil],
|
||||
[NSArray arrayWithObjects: @"10", @"morning", nil],
|
||||
[NSArray arrayWithObjects: @"14", @"afternoon", nil],
|
||||
[NSArray arrayWithObjects: @"19", @"dinner", nil],
|
||||
nil];
|
||||
registrationDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
ampm, NSAMPMDesignation,
|
||||
long_month, NSMonthNameArray,
|
||||
long_day, NSWeekDayNameArray,
|
||||
short_month, NSShortMonthNameArray,
|
||||
short_day, NSShortWeekDayNameArray,
|
||||
@"DMYH", NSDateTimeOrdering,
|
||||
@"tomorrow", NSNextDayDesignations,
|
||||
@"nextday", NSNextNextDayDesignations,
|
||||
@"yesterday", NSPriorDayDesignations,
|
||||
@"today", NSThisDayDesignations,
|
||||
earlyt, NSEarlierTimeDesignations,
|
||||
latert, NSLaterTimeDesignations,
|
||||
hour_names, NSHourNameDesignations,
|
||||
ymw_names, NSYearMonthWeekDesignations,
|
||||
nil];
|
||||
[sharedDefaults registerDefaults: registrationDefaults];
|
||||
}
|
||||
return sharedDefaults;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue