mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
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:
parent
f0673d8bc6
commit
b996c9bca5
5 changed files with 31 additions and 11 deletions
|
@ -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>
|
2002-12-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSSerializer.m: bugfix deserialisation ... was trying to
|
* Source/NSSerializer.m: bugfix deserialisation ... was trying to
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
|
|
||||||
@class NSDictionary;
|
@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);
|
GS_EXPORT NSDictionary *GSDomainFromDefaultLocale(void);
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@
|
||||||
* make use of locale information.
|
* make use of locale information.
|
||||||
*/
|
*/
|
||||||
const char*
|
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
|
/* 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
|
whatever is specified by setlocale) Passing nil will just return the
|
||||||
current locale. */
|
current locale. */
|
||||||
NSString *
|
NSString *
|
||||||
GSSetLocale(NSString *locale)
|
GSSetLocale(int category, NSString *locale)
|
||||||
{
|
{
|
||||||
const char *clocale;
|
const char *clocale;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ GSSetLocale(NSString *locale)
|
||||||
{
|
{
|
||||||
clocale = [locale cString];
|
clocale = [locale cString];
|
||||||
}
|
}
|
||||||
clocale = GSSetLocaleC(clocale);
|
clocale = GSSetLocaleC(category, clocale);
|
||||||
|
|
||||||
if (clocale == NULL || strcmp(clocale, "C") == 0
|
if (clocale == NULL || strcmp(clocale, "C") == 0
|
||||||
|| strcmp(clocale, "POSIX") == 0)
|
|| strcmp(clocale, "POSIX") == 0)
|
||||||
|
@ -184,7 +184,7 @@ GSDomainFromDefaultLocale(void)
|
||||||
|
|
||||||
/* FIXME: Get currency format from localeconv */
|
/* FIXME: Get currency format from localeconv */
|
||||||
|
|
||||||
str1 = GSSetLocale(nil);
|
str1 = GSSetLocale(LC_MESSAGES, nil);
|
||||||
if (str1 != nil)
|
if (str1 != nil)
|
||||||
{
|
{
|
||||||
[dict setObject: str1 forKey: NSLocale];
|
[dict setObject: str1 forKey: NSLocale];
|
||||||
|
@ -213,7 +213,7 @@ GSDomainFromDefaultLocale(void)
|
||||||
|
|
||||||
#else /* HAVE_LOCALE_H */
|
#else /* HAVE_LOCALE_H */
|
||||||
NSString *
|
NSString *
|
||||||
GSSetLocale(NSString *locale)
|
GSSetLocale(int category, NSString *locale)
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
#include <Foundation/NSObjCRuntime.h>
|
#include <Foundation/NSObjCRuntime.h>
|
||||||
#include <Foundation/NSMapTable.h>
|
#include <Foundation/NSMapTable.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <Foundation/GSLocale.h>
|
||||||
|
#ifdef HAVE_LOCALE_H
|
||||||
|
#include <locale.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "GSPrivate.h"
|
#include "GSPrivate.h"
|
||||||
|
|
||||||
|
@ -770,7 +774,6 @@ static BOOL double_release_check_enabled = NO;
|
||||||
if (self == [NSObject class])
|
if (self == [NSObject class])
|
||||||
{
|
{
|
||||||
extern void GSBuildStrings(void); // See externs.m
|
extern void GSBuildStrings(void); // See externs.m
|
||||||
extern const char* GSSetLocaleC(const char*); // See GSLocale.m
|
|
||||||
|
|
||||||
#ifdef __MINGW__
|
#ifdef __MINGW__
|
||||||
// See libgnustep-base-entry.m
|
// See libgnustep-base-entry.m
|
||||||
|
@ -791,7 +794,9 @@ static BOOL double_release_check_enabled = NO;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GSSetLocaleC(""); // Set up locale from environment.
|
#ifdef HAVE_LOCALE_H
|
||||||
|
GSSetLocaleC(LC_ALL, ""); // Set up locale from environment.
|
||||||
|
#endif
|
||||||
|
|
||||||
// Create the global lock
|
// Create the global lock
|
||||||
gnustep_global_lock = [NSRecursiveLock new];
|
gnustep_global_lock = [NSRecursiveLock new];
|
||||||
|
|
|
@ -53,6 +53,9 @@
|
||||||
#include <Foundation/NSValue.h>
|
#include <Foundation/NSValue.h>
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
#include <base/GSLocale.h>
|
#include <base/GSLocale.h>
|
||||||
|
#ifdef HAVE_LOCALE_H
|
||||||
|
#include <locale.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "GSPrivate.h"
|
#include "GSPrivate.h"
|
||||||
|
|
||||||
|
@ -432,7 +435,10 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
||||||
}
|
}
|
||||||
else if (added_locale == NO)
|
else if (added_locale == NO)
|
||||||
{
|
{
|
||||||
NSString *locale = GSSetLocale(nil);
|
NSString *locale;
|
||||||
|
#ifdef HAVE_LOCALE_H
|
||||||
|
locale = GSSetLocale(LC_MESSAGES, nil);
|
||||||
|
#endif
|
||||||
if (locale == nil)
|
if (locale == nil)
|
||||||
continue;
|
continue;
|
||||||
/* See if we can get the dictionary from i18n functions.
|
/* 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);
|
return AUTORELEASE(userLanguages);
|
||||||
}
|
}
|
||||||
userLanguages = RETAIN([NSMutableArray arrayWithCapacity: 5]);
|
userLanguages = RETAIN([NSMutableArray arrayWithCapacity: 5]);
|
||||||
locale = GSSetLocale(@"");
|
|
||||||
if (sharedDefaults == nil)
|
if (sharedDefaults == nil)
|
||||||
{
|
{
|
||||||
/* Create our own defaults to get "NSLanguages" since sharedDefaults
|
/* Create our own defaults to get "NSLanguages" since sharedDefaults
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue