Fix date with natural language strings.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10407 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-07-10 17:19:18 +00:00
parent 61a6f5bd90
commit 2b4239be95
3 changed files with 91 additions and 84 deletions

View file

@ -1,3 +1,7 @@
2001-07-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: Update date/time designations to arrays
* Source/NSDate.m: Update to use date/time designation arrays.
2001-07-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/objc-load.m: Remove bogus include of objc-load.h

View file

@ -264,30 +264,30 @@ GSTimeNow()
*/
if (hadDay == NO)
{
NSString *tdd = [locale objectForKey: NSThisDayDesignations];
NSString *ndd = [locale objectForKey: NSNextDayDesignations];
NSString *pdd = [locale objectForKey: NSPriorDayDesignations];
NSString *nndd = [locale objectForKey: NSNextNextDayDesignations];
NSArray *tdd = [locale objectForKey: NSThisDayDesignations];
NSArray *ndd = [locale objectForKey: NSNextDayDesignations];
NSArray *pdd = [locale objectForKey: NSPriorDayDesignations];
NSArray *nndd = [locale objectForKey: NSNextNextDayDesignations];
for (index = 0; hadDay == NO && index < [words count]; index++)
{
tmp = [words objectAtIndex: index];
if ([tmp caseInsensitiveCompare: tdd] == NSOrderedSame)
if (findInArray(tdd, 0 ,tmp) != nil)
{
hadDay = YES;
}
else if ([tmp caseInsensitiveCompare: ndd] == NSOrderedSame)
else if (findInArray(ndd, 0 ,tmp) != nil)
{
modDay++;
hadDay = YES;
}
else if ([tmp caseInsensitiveCompare: nndd] == NSOrderedSame)
else if (findInArray(nndd, 0 ,tmp) != nil)
{
modDay += 2;
hadDay = YES;
}
else if ([tmp caseInsensitiveCompare: pdd] == NSOrderedSame)
else if (findInArray(pdd, 0 ,tmp) != nil)
{
modDay--;
hadDay = YES;

View file

@ -144,6 +144,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
NSArray *ymw_names;
ampm = [NSArray arrayWithObjects: @"AM", @"PM", nil];
short_month = [NSArray arrayWithObjects:
@"Jan",
@"Feb",
@ -158,6 +159,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
@"Nov",
@"Dec",
nil];
long_month = [NSArray arrayWithObjects:
@"January",
@"February",
@ -172,6 +174,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
@"November",
@"December",
nil];
short_day = [NSArray arrayWithObjects:
@"Sun",
@"Mon",
@ -181,6 +184,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
@"Fri",
@"Sat",
nil];
long_day = [NSArray arrayWithObjects:
@"Sunday",
@"Monday",
@ -190,20 +194,18 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
@"Friday",
@"Saturday",
nil];
earlyt = [NSArray arrayWithObjects:
@"prior",
@"last",
@"past",
@"ago",
nil];
latert = [NSArray arrayWithObjects:
@"next",
nil];
ymw_names = [NSArray arrayWithObjects:
@"year",
@"month",
@"week",
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],
@ -211,6 +213,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
[NSArray arrayWithObjects: @"14", @"afternoon", nil],
[NSArray arrayWithObjects: @"19", @"dinner", nil],
nil];
registrationDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
ampm, NSAMPMDesignation,
long_month, NSMonthNameArray,
@ -218,10 +221,10 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
short_month, NSShortMonthNameArray,
short_day, NSShortWeekDayNameArray,
@"DMYH", NSDateTimeOrdering,
@"tomorrow", NSNextDayDesignations,
@"nextday", NSNextNextDayDesignations,
@"yesterday", NSPriorDayDesignations,
@"today", NSThisDayDesignations,
[NSArray arrayWithObject: @"tomorrow"], NSNextDayDesignations,
[NSArray arrayWithObject: @"nextday"], NSNextNextDayDesignations,
[NSArray arrayWithObject: @"yesterday"], NSPriorDayDesignations,
[NSArray arrayWithObject: @"today"], NSThisDayDesignations,
earlyt, NSEarlierTimeDesignations,
latert, NSLaterTimeDesignations,
hour_names, NSHourNameDesignations,