From afc8ff1c4723c91d626cd09b11674032b42d9c2f Mon Sep 17 00:00:00 2001 From: Wolfgang Lux Date: Thu, 10 Mar 2016 08:48:40 +0000 Subject: [PATCH] Add method +[NSLocale localeWithLocaleIdentifier:], which was introduced in OS X 10.6. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39516 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Headers/Foundation/NSLocale.h | 6 ++++++ Source/NSLocale.m | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index dc5c00be7..90f9e8efa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-03-10 Wolfgang Lux + + * Headers/Foundation/NSLocale.h: + * Source/NSLocale.m (+localeWithLocaleIdentifier:): + Add trivial method introduced in OS X 10.6. + 2016-03-09 Riccardo Mottola * Headers/Foundation/NSPathUtilities.h diff --git a/Headers/Foundation/NSLocale.h b/Headers/Foundation/NSLocale.h index 5d07dc00c..7f8f80b1b 100644 --- a/Headers/Foundation/NSLocale.h +++ b/Headers/Foundation/NSLocale.h @@ -186,6 +186,12 @@ GS_EXPORT NSString * const NSISO8601Calendar; + (NSString *) localeIdentifierFromWindowsLocaleCode: (uint32_t)lcid; #endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +/** Returns a locale initialised with the given locale identifier. + */ ++ (id) localeWithLocaleIdentifier:(NSString *)string; +#endif + #if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) /** Returns an array of preferred languages. Sorted from most preferred to * leave preferred. diff --git a/Source/NSLocale.m b/Source/NSLocale.m index 209998f6d..23ba3ce03 100644 --- a/Source/NSLocale.m +++ b/Source/NSLocale.m @@ -588,6 +588,11 @@ static NSRecursiveLock *classLock = nil; return AUTORELEASE(result); } ++ (id) localeWithLocaleIdentifier:(NSString *)string +{ + return AUTORELEASE([[NSLocale alloc] initWithLocaleIdentifier: string]); +} + + (NSString *) localeIdentifierFromComponents: (NSDictionary *) dict { NSString *result;