mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
try to allow iso language names in languages array
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34654 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6a2c32df1f
commit
e97102ae94
2 changed files with 28 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
2012-01-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSUserDefaults.m: Try to deal with the case where a language
|
||||
has been set to the ISO standard name rather than an OpenStep name
|
||||
by converting to an Openstep name as an alternative lookup key.
|
||||
|
||||
2012-01-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSFileManager.m: Fix copying for large files (issue #35381)
|
||||
|
|
|
@ -947,18 +947,32 @@ newLanguages(NSArray *oldNames)
|
|||
{
|
||||
NSDictionary *dict = nil;
|
||||
NSString *path = nil;
|
||||
NSEnumerator *pathEnumerator = [paths objectEnumerator];
|
||||
NSString *alt;
|
||||
NSEnumerator *pathEnumerator;
|
||||
|
||||
/* The language name could be an ISO language identifier rather
|
||||
* than an OpenStep name (OSX has moved to using them), so we
|
||||
* try converting as an alternative key for lookup.
|
||||
*/
|
||||
alt = GSLanguageFromLocale(lang);
|
||||
pathEnumerator = [paths objectEnumerator];
|
||||
while ((path = [pathEnumerator nextObject]) != nil)
|
||||
{
|
||||
path = [[path stringByAppendingPathComponent: tail]
|
||||
stringByAppendingPathComponent: lang];
|
||||
|
||||
stringByAppendingPathComponent: lang];
|
||||
if ([fm fileExistsAtPath: path])
|
||||
{
|
||||
/* Path found! */
|
||||
break;
|
||||
break; /* Path found! */
|
||||
}
|
||||
if (nil != alt)
|
||||
{
|
||||
path = [[path stringByAppendingPathComponent: tail]
|
||||
stringByAppendingPathComponent: alt];
|
||||
if ([fm fileExistsAtPath: path])
|
||||
{
|
||||
break; /* Path found! */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (path != nil)
|
||||
|
@ -989,6 +1003,8 @@ newLanguages(NSArray *oldNames)
|
|||
#endif
|
||||
if (locale != nil)
|
||||
{
|
||||
NSString *i18n = GSLanguageFromLocale(locale);
|
||||
|
||||
/* See if we can get the dictionary from i18n
|
||||
* functions. I don't think that the i18n routines
|
||||
* can handle more than one locale, so we don't try to
|
||||
|
@ -996,7 +1012,7 @@ newLanguages(NSArray *oldNames)
|
|||
* if it matches 'lang' ... but tell me if I'm wrong
|
||||
* ...
|
||||
*/
|
||||
if ([lang isEqualToString: GSLanguageFromLocale (locale)])
|
||||
if ([lang isEqual: i18n] || [alt isEqualToString: i18n])
|
||||
{
|
||||
/* We set added_locale to YES to avoid so that we
|
||||
* won't do this C library locale lookup again
|
||||
|
|
Loading…
Reference in a new issue