NSString locale updates.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9461 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Jonathan Gapen 2001-03-20 02:13:19 +00:00
parent cb8b09362f
commit dff26ccc9c
2 changed files with 37 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2001-03-19 Jonathan Gapen <jagapen@home.com>
* Source/NSString.m: Implement ([-localizedStringWithFormat:]).
Fix ([-localizedCompare:]) and ([-localizedCaseInsensitiveCompare:]).
(They will work when ([-compare:options:range:locale:]) works.)
2001-03-19 Jonathan Gapen <jagapen@home.com>
* Source/NSAutoreleasePool.m, Source/NSCharacterSet.m,

View file

@ -34,8 +34,8 @@
on non-GNU-libc systems.
*/
/* Initial implementation of Unicode. Version 0.0.0 : )
Locales not yet supported.
/*
Locales somewhat supported.
Limited choice of default encodings.
*/
@ -2855,8 +2855,23 @@ handle_printf_atsign (FILE *stream,
+ (NSString*) localizedStringWithFormat: (NSString*) format, ...
{
[self notImplemented: _cmd];
return self;
va_list ap;
id ret;
NSDictionary *dict;
va_start(ap, format);
if (format == nil)
{
ret = nil;
}
else
{
dict = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
ret = AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
initWithFormat: format locale: dict arguments: ap]);
}
va_end(ap);
return ret;
}
- (NSComparisonResult) caseInsensitiveCompare: (NSString*)aString
@ -2879,18 +2894,24 @@ handle_printf_atsign (FILE *stream,
- (NSComparisonResult) localizedCompare: (NSString *)string
{
// FIXME: This does only a normal compare
NSDictionary *dict =
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
return [self compare: string
options: 0
range: ((NSRange){0, [self length]})];
options: 0
range: ((NSRange){0, [self length]})
locale: dict];
}
- (NSComparisonResult) localizedCaseInsensitiveCompare: (NSString *)string
{
// FIXME: This does only a normal compare
NSDictionary *dict =
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
return [self compare: string
options: NSCaseInsensitiveSearch
range: ((NSRange){0, [self length]})];
options: NSCaseInsensitiveSearch
range: ((NSRange){0, [self length]})
locale: dict];
}
- (BOOL) writeToFile: (NSString*)filename
@ -3199,7 +3220,6 @@ handle_printf_atsign (FILE *stream,
NSDefaultMallocZone()] initWithCString: byteString length: length]);
}
/* xxx Change this when we have non-CString classes */
+ (NSString*) stringWithFormat: (NSString*)format, ...
{
va_list ap;