Update def of GSSetLocale

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15249 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-12-05 04:24:43 +00:00
parent 311b522618
commit 52bf284361
5 changed files with 31 additions and 11 deletions

View file

@ -1,3 +1,12 @@
2002-12-04 Adam Fedor <fedor@gnu.org>
* Headers/gnustep/base/GSLocale.h: Add category arg to
SetLocale functions.
* Source/GSLocale.m (GSSetLocaleC, GSSetLocale): Update for change.
* Source/NSObject.m (+initialize): Idem.
* Source/NSUserDefaults.m ([NSUserDefaults +standardUserDefaults]):
Idem.
2002-12-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSerializer.m: bugfix deserialisation ... was trying to

View file

@ -29,7 +29,8 @@
@class NSDictionary;
GS_EXPORT NSString *GSSetLocale(NSString *locale);
GS_EXPORT const char *GSSetLocaleC(int category, const char *loc);
GS_EXPORT NSString *GSSetLocale(int category, NSString *locale);
GS_EXPORT NSDictionary *GSDomainFromDefaultLocale(void);

View file

@ -43,9 +43,9 @@
* make use of locale information.
*/
const char*
GSSetLocaleC(const char *loc)
GSSetLocaleC(int category, const char *loc)
{
return setlocale(LC_CTYPE, loc);
return setlocale(category, loc);
}
/* Set the locale for libc functions from the supplied string or from
@ -55,7 +55,7 @@ GSSetLocaleC(const char *loc)
whatever is specified by setlocale) Passing nil will just return the
current locale. */
NSString *
GSSetLocale(NSString *locale)
GSSetLocale(int category, NSString *locale)
{
const char *clocale;
@ -64,7 +64,7 @@ GSSetLocale(NSString *locale)
{
clocale = [locale cString];
}
clocale = GSSetLocaleC(clocale);
clocale = GSSetLocaleC(category, clocale);
if (clocale == NULL || strcmp(clocale, "C") == 0
|| strcmp(clocale, "POSIX") == 0)
@ -184,7 +184,7 @@ GSDomainFromDefaultLocale(void)
/* FIXME: Get currency format from localeconv */
str1 = GSSetLocale(nil);
str1 = GSSetLocale(LC_MESSAGES, nil);
if (str1 != nil)
{
[dict setObject: str1 forKey: NSLocale];
@ -213,7 +213,7 @@ GSDomainFromDefaultLocale(void)
#else /* HAVE_LOCALE_H */
NSString *
GSSetLocale(NSString *locale)
GSSetLocale(int category, NSString *locale)
{
return nil;
}

View file

@ -44,6 +44,10 @@
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSMapTable.h>
#include <limits.h>
#include <Foundation/GSLocale.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#include "GSPrivate.h"
@ -770,7 +774,6 @@ static BOOL double_release_check_enabled = NO;
if (self == [NSObject class])
{
extern void GSBuildStrings(void); // See externs.m
extern const char* GSSetLocaleC(const char*); // See GSLocale.m
#ifdef __MINGW__
// See libgnustep-base-entry.m
@ -791,7 +794,9 @@ static BOOL double_release_check_enabled = NO;
}
#endif
GSSetLocaleC(""); // Set up locale from environment.
#ifdef HAVE_LOCALE_H
GSSetLocaleC(LC_ALL, ""); // Set up locale from environment.
#endif
// Create the global lock
gnustep_global_lock = [NSRecursiveLock new];

View file

@ -53,6 +53,9 @@
#include <Foundation/NSValue.h>
#include <Foundation/NSDebug.h>
#include <base/GSLocale.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#include "GSPrivate.h"
@ -432,7 +435,10 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
}
else if (added_locale == NO)
{
NSString *locale = GSSetLocale(nil);
NSString *locale;
#ifdef HAVE_LOCALE_H
locale = GSSetLocale(LC_MESSAGES, nil);
#endif
if (locale == nil)
continue;
/* See if we can get the dictionary from i18n functions.
@ -479,7 +485,6 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
return AUTORELEASE(userLanguages);
}
userLanguages = RETAIN([NSMutableArray arrayWithCapacity: 5]);
locale = GSSetLocale(@"");
if (sharedDefaults == nil)
{
/* Create our own defaults to get "NSLanguages" since sharedDefaults