handle secondary subtags between 2 and 8 characters long, as

per RFC 3066 et al. when setting accept-lang header (bug 293327)
This commit is contained in:
pinkerton%aol.net 2005-06-10 17:23:17 +00:00
parent e604f9264e
commit 0e1f096534

View File

@ -314,7 +314,11 @@ static BOOL gMadePrefManager;
[language appendString:[[localeParts objectAtIndex:1] lowercaseString]];
}
if ( [language length] == 2 || ( [language length] == 5 && [language characterAtIndex:2] == '-' ) )
// We accept standalone primary subtags (e.g. "en") and also
// a primary subtag with additional subtags of between two and eight characters long
// We ignore i- and x- primary subtags
if ( [language length] == 2 ||
( [language length] >= 5 && [language length] <= 13 && [language characterAtIndex:2] == '-' ) )
r = [NSString stringWithString:language];
}
return r;