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;