mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
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:
parent
61a6f5bd90
commit
2b4239be95
3 changed files with 91 additions and 84 deletions
|
@ -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>
|
2001-07-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/objc-load.m: Remove bogus include of objc-load.h
|
* Source/objc-load.m: Remove bogus include of objc-load.h
|
||||||
|
|
|
@ -264,30 +264,30 @@ GSTimeNow()
|
||||||
*/
|
*/
|
||||||
if (hadDay == NO)
|
if (hadDay == NO)
|
||||||
{
|
{
|
||||||
NSString *tdd = [locale objectForKey: NSThisDayDesignations];
|
NSArray *tdd = [locale objectForKey: NSThisDayDesignations];
|
||||||
NSString *ndd = [locale objectForKey: NSNextDayDesignations];
|
NSArray *ndd = [locale objectForKey: NSNextDayDesignations];
|
||||||
NSString *pdd = [locale objectForKey: NSPriorDayDesignations];
|
NSArray *pdd = [locale objectForKey: NSPriorDayDesignations];
|
||||||
NSString *nndd = [locale objectForKey: NSNextNextDayDesignations];
|
NSArray *nndd = [locale objectForKey: NSNextNextDayDesignations];
|
||||||
|
|
||||||
for (index = 0; hadDay == NO && index < [words count]; index++)
|
for (index = 0; hadDay == NO && index < [words count]; index++)
|
||||||
{
|
{
|
||||||
tmp = [words objectAtIndex: index];
|
tmp = [words objectAtIndex: index];
|
||||||
|
|
||||||
if ([tmp caseInsensitiveCompare: tdd] == NSOrderedSame)
|
if (findInArray(tdd, 0 ,tmp) != nil)
|
||||||
{
|
{
|
||||||
hadDay = YES;
|
hadDay = YES;
|
||||||
}
|
}
|
||||||
else if ([tmp caseInsensitiveCompare: ndd] == NSOrderedSame)
|
else if (findInArray(ndd, 0 ,tmp) != nil)
|
||||||
{
|
{
|
||||||
modDay++;
|
modDay++;
|
||||||
hadDay = YES;
|
hadDay = YES;
|
||||||
}
|
}
|
||||||
else if ([tmp caseInsensitiveCompare: nndd] == NSOrderedSame)
|
else if (findInArray(nndd, 0 ,tmp) != nil)
|
||||||
{
|
{
|
||||||
modDay += 2;
|
modDay += 2;
|
||||||
hadDay = YES;
|
hadDay = YES;
|
||||||
}
|
}
|
||||||
else if ([tmp caseInsensitiveCompare: pdd] == NSOrderedSame)
|
else if (findInArray(pdd, 0 ,tmp) != nil)
|
||||||
{
|
{
|
||||||
modDay--;
|
modDay--;
|
||||||
hadDay = YES;
|
hadDay = YES;
|
||||||
|
|
|
@ -144,6 +144,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
||||||
NSArray *ymw_names;
|
NSArray *ymw_names;
|
||||||
|
|
||||||
ampm = [NSArray arrayWithObjects: @"AM", @"PM", nil];
|
ampm = [NSArray arrayWithObjects: @"AM", @"PM", nil];
|
||||||
|
|
||||||
short_month = [NSArray arrayWithObjects:
|
short_month = [NSArray arrayWithObjects:
|
||||||
@"Jan",
|
@"Jan",
|
||||||
@"Feb",
|
@"Feb",
|
||||||
|
@ -158,6 +159,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
||||||
@"Nov",
|
@"Nov",
|
||||||
@"Dec",
|
@"Dec",
|
||||||
nil];
|
nil];
|
||||||
|
|
||||||
long_month = [NSArray arrayWithObjects:
|
long_month = [NSArray arrayWithObjects:
|
||||||
@"January",
|
@"January",
|
||||||
@"February",
|
@"February",
|
||||||
|
@ -172,6 +174,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
||||||
@"November",
|
@"November",
|
||||||
@"December",
|
@"December",
|
||||||
nil];
|
nil];
|
||||||
|
|
||||||
short_day = [NSArray arrayWithObjects:
|
short_day = [NSArray arrayWithObjects:
|
||||||
@"Sun",
|
@"Sun",
|
||||||
@"Mon",
|
@"Mon",
|
||||||
|
@ -181,6 +184,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
||||||
@"Fri",
|
@"Fri",
|
||||||
@"Sat",
|
@"Sat",
|
||||||
nil];
|
nil];
|
||||||
|
|
||||||
long_day = [NSArray arrayWithObjects:
|
long_day = [NSArray arrayWithObjects:
|
||||||
@"Sunday",
|
@"Sunday",
|
||||||
@"Monday",
|
@"Monday",
|
||||||
|
@ -190,20 +194,18 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
||||||
@"Friday",
|
@"Friday",
|
||||||
@"Saturday",
|
@"Saturday",
|
||||||
nil];
|
nil];
|
||||||
|
|
||||||
earlyt = [NSArray arrayWithObjects:
|
earlyt = [NSArray arrayWithObjects:
|
||||||
@"prior",
|
@"prior",
|
||||||
@"last",
|
@"last",
|
||||||
@"past",
|
@"past",
|
||||||
@"ago",
|
@"ago",
|
||||||
nil];
|
nil];
|
||||||
latert = [NSArray arrayWithObjects:
|
|
||||||
@"next",
|
latert = [NSArray arrayWithObjects: @"next", nil];
|
||||||
nil];
|
|
||||||
ymw_names = [NSArray arrayWithObjects:
|
ymw_names = [NSArray arrayWithObjects: @"year", @"month", @"week", nil];
|
||||||
@"year",
|
|
||||||
@"month",
|
|
||||||
@"week",
|
|
||||||
nil];
|
|
||||||
hour_names = [NSArray arrayWithObjects:
|
hour_names = [NSArray arrayWithObjects:
|
||||||
[NSArray arrayWithObjects: @"0", @"midnight", nil],
|
[NSArray arrayWithObjects: @"0", @"midnight", nil],
|
||||||
[NSArray arrayWithObjects: @"12", @"noon", @"lunch", 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: @"14", @"afternoon", nil],
|
||||||
[NSArray arrayWithObjects: @"19", @"dinner", nil],
|
[NSArray arrayWithObjects: @"19", @"dinner", nil],
|
||||||
nil];
|
nil];
|
||||||
|
|
||||||
registrationDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
|
registrationDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
ampm, NSAMPMDesignation,
|
ampm, NSAMPMDesignation,
|
||||||
long_month, NSMonthNameArray,
|
long_month, NSMonthNameArray,
|
||||||
|
@ -218,10 +221,10 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
||||||
short_month, NSShortMonthNameArray,
|
short_month, NSShortMonthNameArray,
|
||||||
short_day, NSShortWeekDayNameArray,
|
short_day, NSShortWeekDayNameArray,
|
||||||
@"DMYH", NSDateTimeOrdering,
|
@"DMYH", NSDateTimeOrdering,
|
||||||
@"tomorrow", NSNextDayDesignations,
|
[NSArray arrayWithObject: @"tomorrow"], NSNextDayDesignations,
|
||||||
@"nextday", NSNextNextDayDesignations,
|
[NSArray arrayWithObject: @"nextday"], NSNextNextDayDesignations,
|
||||||
@"yesterday", NSPriorDayDesignations,
|
[NSArray arrayWithObject: @"yesterday"], NSPriorDayDesignations,
|
||||||
@"today", NSThisDayDesignations,
|
[NSArray arrayWithObject: @"today"], NSThisDayDesignations,
|
||||||
earlyt, NSEarlierTimeDesignations,
|
earlyt, NSEarlierTimeDesignations,
|
||||||
latert, NSLaterTimeDesignations,
|
latert, NSLaterTimeDesignations,
|
||||||
hour_names, NSHourNameDesignations,
|
hour_names, NSHourNameDesignations,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue