mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-27 18:50:47 +00:00
Added NSCalendar dependent code even though NSCalendar doesn't currently do anything.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31736 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d150a82634
commit
4e7ec715e3
2 changed files with 28 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2010-12-14 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSLocale.m: Added NSCalendar dependent code.
|
||||||
|
|
||||||
2010-12-14 Stefan Bidigaray <stefanbidi@gmail.com>
|
2010-12-14 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||||
|
|
||||||
* Headers/Foundation/Foundation.h:
|
* Headers/Foundation/Foundation.h:
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#import "common.h"
|
#import "common.h"
|
||||||
#import "Foundation/NSLocale.h"
|
#import "Foundation/NSLocale.h"
|
||||||
#import "Foundation/NSArray.h"
|
#import "Foundation/NSArray.h"
|
||||||
//#import "Foundation/NSCalendar.h"
|
#import "Foundation/NSCalendar.h"
|
||||||
#import "Foundation/NSCoder.h"
|
#import "Foundation/NSCoder.h"
|
||||||
#import "Foundation/NSCharacterSet.h"
|
#import "Foundation/NSCharacterSet.h"
|
||||||
#import "Foundation/NSDictionary.h"
|
#import "Foundation/NSDictionary.h"
|
||||||
|
@ -157,8 +157,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
- (NSString *) _getMeasurementSystem;
|
- (NSString *) _getMeasurementSystem;
|
||||||
- (NSCharacterSet *) _getExemplarCharacterSet;
|
- (NSCharacterSet *) _getExemplarCharacterSet;
|
||||||
- (NSString *) _getDelimiterWithType: (NSInteger) delimiterType;
|
- (NSString *) _getDelimiterWithType: (NSInteger) delimiterType;
|
||||||
//- (NSCalendar *) _getCalendar;
|
- (NSCalendar *) _getCalendar;
|
||||||
- (id) _getCalendar;
|
|
||||||
- (NSString *) _getDecimalSeparator;
|
- (NSString *) _getDecimalSeparator;
|
||||||
- (NSString *) _getGroupingSeparator;
|
- (NSString *) _getGroupingSeparator;
|
||||||
- (NSString *) _getCurrencySymbol;
|
- (NSString *) _getCurrencySymbol;
|
||||||
|
@ -175,7 +174,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
UErrorCode err = U_ZERO_ERROR;
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
NSString *result = nil;
|
NSString *result = nil;
|
||||||
|
|
||||||
cLocaleId = [[self localeIdentifier] UTF8String];
|
cLocaleId = [_localeId UTF8String];
|
||||||
localeData = ulocdata_open (cLocaleId, &err);
|
localeData = ulocdata_open (cLocaleId, &err);
|
||||||
if (U_FAILURE(err))
|
if (U_FAILURE(err))
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -208,7 +207,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
if (mSet == nil)
|
if (mSet == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
cLocaleId = [[self localeIdentifier] UTF8String];
|
cLocaleId = [_localeId UTF8String];
|
||||||
localeData = ulocdata_open (cLocaleId, &err);
|
localeData = ulocdata_open (cLocaleId, &err);
|
||||||
if (U_FAILURE(err))
|
if (U_FAILURE(err))
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -259,7 +258,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
ULocaleData *localeData;
|
ULocaleData *localeData;
|
||||||
UChar result[32]; // Arbritrary size
|
UChar result[32]; // Arbritrary size
|
||||||
|
|
||||||
cLocaleId = [[self localeIdentifier] UTF8String];
|
cLocaleId = [_localeId UTF8String];
|
||||||
localeData = ulocdata_open (cLocaleId, &err);
|
localeData = ulocdata_open (cLocaleId, &err);
|
||||||
strLen = ulocdata_getDelimiter (localeData, delimiterType, result, 32, &err);
|
strLen = ulocdata_getDelimiter (localeData, delimiterType, result, 32, &err);
|
||||||
if (U_SUCCESS(err))
|
if (U_SUCCESS(err))
|
||||||
|
@ -268,11 +267,24 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- (NSCalendar *) _getCalendar
|
- (NSCalendar *) _getCalendar
|
||||||
- (id) _getCalendar
|
|
||||||
{
|
{
|
||||||
// FIXME: requires NSCalendar
|
NSCalendar *result;
|
||||||
return nil;
|
NSString *calId;
|
||||||
|
int strLen;
|
||||||
|
char buffer[ULOC_KEYWORDS_CAPACITY];
|
||||||
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
|
|
||||||
|
strLen = uloc_getKeywordValue ([_localeId UTF8String], ICUCalendarKeyword,
|
||||||
|
buffer, ULOC_KEYWORDS_CAPACITY, &err);
|
||||||
|
if (U_SUCCESS(err) && strLen > 0)
|
||||||
|
calId = [NSString stringWithUTF8String: buffer];
|
||||||
|
else
|
||||||
|
calId = NSGregorianCalendar;
|
||||||
|
|
||||||
|
result = [[NSCalendar alloc] initWithCalendarIdentifier: calId];
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: these should be fairly simple, but require changes to NSNumberFormatter.
|
// FIXME: these should be fairly simple, but require changes to NSNumberFormatter.
|
||||||
|
@ -641,7 +653,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
unichar buffer[ULOC_FULLNAME_CAPACITY];
|
unichar buffer[ULOC_FULLNAME_CAPACITY];
|
||||||
UErrorCode status;
|
UErrorCode status;
|
||||||
const char *keyword = NULL;
|
const char *keyword = NULL;
|
||||||
const char *locale = [[self localeIdentifier] UTF8String];
|
const char *locale = [_localeId UTF8String];
|
||||||
|
|
||||||
if ([key isEqualToString: NSLocaleIdentifier])
|
if ([key isEqualToString: NSLocaleIdentifier])
|
||||||
{
|
{
|
||||||
|
@ -762,7 +774,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
if ([_components count] == 0)
|
if ([_components count] == 0)
|
||||||
{
|
{
|
||||||
[_components addEntriesFromDictionary:
|
[_components addEntriesFromDictionary:
|
||||||
[NSLocale componentsFromLocaleIdentifier: [self localeIdentifier]]];
|
[NSLocale componentsFromLocaleIdentifier: _localeId]];
|
||||||
if ((result = [_components objectForKey: key]))
|
if ((result = [_components objectForKey: key]))
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue