mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Make NSLocale use information about libicu availablity (perviously, it would
never build the ICU stuff because the corresponding macro wasn't defined). git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30995 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b666cd6884
commit
4848c265e9
4 changed files with 68 additions and 57 deletions
|
@ -1,3 +1,12 @@
|
|||
2010-07-19 Niels Grewe <niels.grewe@halbordnung.de>
|
||||
|
||||
* Headers/Additions/GNUstepBase/GSConfig.h: Define GS_USE_ICU when
|
||||
the configure script indicates libicu availablity.
|
||||
* Headers/Foundation/Foundation.h: Import NSLocale.h
|
||||
* Source/NSLocale.m: Change tests to use GS_USE_ICU.
|
||||
Make sure that the parts of NSLocale relying on ICU actually get built
|
||||
when libicu is available.
|
||||
|
||||
2010-07-17 Quentin Mathe <quentin.mathe@gmail.com>
|
||||
|
||||
* Tools/autogsdoc.m:
|
||||
|
|
|
@ -223,6 +223,7 @@ typedef struct {
|
|||
#define GS_MIXEDABI @GS_MIXEDABI@
|
||||
#define GS_USE_AVAHI @HAVE_AVAHI@
|
||||
#define GS_USE_MDNS @HAVE_MDNS@
|
||||
#define GS_USE_ICU @HAVE_ICU@
|
||||
#import <GNUstepBase/preface.h>
|
||||
|
||||
#endif /* included_GSConfig_h */
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
#import <Foundation/NSKeyedArchiver.h>
|
||||
#import <Foundation/NSKeyValueCoding.h>
|
||||
#import <Foundation/NSKeyValueObserving.h>
|
||||
#import <Foundation/NSLocale.h>
|
||||
#import <Foundation/NSLock.h>
|
||||
#import <Foundation/NSMapTable.h>
|
||||
#import <Foundation/NSMethodSignature.h>
|
||||
|
|
|
@ -126,7 +126,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
NSMutableArray *currencies = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
char *currCode;
|
||||
const char *currCode;
|
||||
UEnumeration *codes = ucurr_openISOCurrencies (currType, &error);
|
||||
if (U_FAILURE(error))
|
||||
return nil;
|
||||
|
@ -180,7 +180,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
{
|
||||
static NSArray *available = nil;
|
||||
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
if (nil == available)
|
||||
{
|
||||
[classLock lock];
|
||||
|
@ -222,7 +222,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
+ (NSLocaleLanguageDirection) characterDirectionForLanguage:
|
||||
(NSString *)isoLangCode
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
ULayoutType result;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
@ -238,7 +238,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
|
||||
+ (NSDictionary *) componentsFromLocaleIdentifier: (NSString *) string
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
char buffer[ULOC_LANG_CAPACITY];
|
||||
int32_t strLength;
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
|
@ -297,7 +297,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
[classLock lock];
|
||||
if (nil == currentLocale)
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
const char *cLocaleId = uloc_getDefault ();
|
||||
NSString *localeId = [NSString stringWithCString: cLocaleId];
|
||||
currentLocale = [[NSLocale alloc] initWithLocaleIdentifier: localeId];
|
||||
|
@ -310,7 +310,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
|
||||
+ (NSArray *) commonISOCurrencyCodes
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
return _currencyCodesWithType (UCURR_COMMON | UCURR_NON_DEPRECATED);
|
||||
#else
|
||||
return nil; // FIXME
|
||||
|
@ -319,7 +319,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
|
||||
+ (NSArray *) ISOCurrencyCodes
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
return _currencyCodesWithType (UCURR_ALL);
|
||||
#else
|
||||
return nil; // FIXME
|
||||
|
@ -335,7 +335,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
[classLock lock];
|
||||
if (nil == countries)
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
const char *const *codes = uloc_getISOCountries ();
|
||||
|
||||
|
@ -361,7 +361,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
[classLock lock];
|
||||
if (nil == languages)
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
const char *const *codes = uloc_getISOCountries ();
|
||||
|
||||
|
@ -380,7 +380,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
|
||||
+ (NSLocaleLanguageDirection) lineDirectionForLanguage: (NSString *) isoLangCode
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
ULayoutType result;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
@ -417,7 +417,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
|
||||
+ (NSString *) localeIdentifierFromComponents: (NSDictionary *) dict
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
char buffer[ULOC_FULLNAME_CAPACITY];
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const char *language = [[dict objectForKey: NSLocaleLanguageCode] cString];
|
||||
|
@ -452,7 +452,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
|
||||
+ (NSString *) localeIdentifierFromWindowsLocaleCode: (uint32_t) lcid
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
char buffer[ULOC_FULLNAME_CAPACITY];
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
@ -469,7 +469,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
|
||||
+ (uint32_t) windowsLocaleCodeFromLocaleIdentifier: (NSString *)localeIdentifier
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
return uloc_getLCID ([localeIdentifier cString]);
|
||||
#else
|
||||
return 0; // FIXME
|
||||
|
@ -478,7 +478,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
|
||||
- (NSString *) displayNameForKey: (id) key value: (id) value
|
||||
{
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
int32_t length;
|
||||
unichar buffer[ULOC_FULLNAME_CAPACITY];
|
||||
UErrorCode status;
|
||||
|
@ -500,7 +500,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
|||
{
|
||||
NSLocale *newLocale;
|
||||
NSString *localeId;
|
||||
#if HAVE_ICU
|
||||
#if GS_USE_ICU == 1
|
||||
int32_t length;
|
||||
char cLocaleId[ULOC_FULLNAME_CAPACITY];
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue