Improve MKV LanguageBCP47 conversion
This commit is contained in:
3 files changed
+14
-3
No files matched your search
+12
-2
@@ -817,8 +817,18 @@ MP42_OBJC_DIRECT_MEMBERS
|
||||
#pragma mark - Validation
|
||||
|
||||
- (BOOL)validateExtendedTag:(NSString *)tag {
|
||||
NSString *fixedCode = [tag stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
|
||||
return [NSLocale.availableLocaleIdentifiers containsObject:fixedCode];
|
||||
NSString *fixedTag = [tag stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
|
||||
return [NSLocale.availableLocaleIdentifiers containsObject:fixedTag];
|
||||
}
|
||||
|
||||
- (nullable NSString *)normalizedExtendedTag:(NSString *)tag {
|
||||
NSString *fixedTag = [tag stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
|
||||
for (NSString *identifier in NSLocale.availableLocaleIdentifiers) {
|
||||
if ([identifier caseInsensitiveCompare:fixedTag] == NSOrderedSame) {
|
||||
return [identifier stringByReplacingOccurrencesOfString:@"_" withString:@"-"];
|
||||
}
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user