Commit 2d76fb74 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Prefix NSString extension

parent 9fafcd21
......@@ -44,7 +44,7 @@
if ([preferredLanguage containsString:@"-"]) {
preferredLanguage = [[preferredLanguage componentsSeparatedByString:@"-"] firstObject];
}
selectedLocale = [preferredLanguage threeLetterLanguageKeyForTwoLetterCode];
selectedLocale = [preferredLanguage VLCthreeLetterLanguageKeyForTwoLetterCode];
/* last resort */
if (selectedLocale == nil) {
selectedLocale = @"eng";
......@@ -155,7 +155,7 @@
} else {
NSString *selectedLocale = [[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingLastUsedSubtitlesSearchLanguage];
cell.textLabel.text = NSLocalizedString(@"LANGUAGE", nil);
NSString *detail = [[selectedLocale twoLetterLanguageKeyForThreeLetterCode] localizedLanguageNameForTwoLetterCode];
NSString *detail = [[selectedLocale VLCtwoLetterLanguageKeyForThreeLetterCode] VLClocalizedLanguageNameForTwoLetterCode];
cell.detailTextLabel.text = detail ? detail : selectedLocale;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
......
......@@ -13,8 +13,8 @@
@interface NSString (LocaleCodes)
- (NSString *)twoLetterLanguageKeyForThreeLetterCode;
- (NSString *)threeLetterLanguageKeyForTwoLetterCode;
- (NSString *)localizedLanguageNameForTwoLetterCode;
- (NSString *)VLCtwoLetterLanguageKeyForThreeLetterCode;
- (NSString *)VLCthreeLetterLanguageKeyForTwoLetterCode;
- (NSString *)VLClocalizedLanguageNameForTwoLetterCode;
@end
......@@ -14,7 +14,7 @@
@implementation NSString (LocaleCodes)
- (NSString *)twoLetterLanguageKeyForThreeLetterCode
- (NSString *)VLCtwoLetterLanguageKeyForThreeLetterCode
{
NSDictionary *searchDict = @{@"alb" : @"sq",
@"ara" : @"ar",
......@@ -77,7 +77,7 @@
return searchDict[self];
}
- (NSString *)threeLetterLanguageKeyForTwoLetterCode
- (NSString *)VLCthreeLetterLanguageKeyForTwoLetterCode
{
NSDictionary *searchDict = @{@"sq" : @"alb",
@"ar" : @"ara",
......@@ -145,7 +145,7 @@
return searchDict[self];
}
- (NSString *)localizedLanguageNameForTwoLetterCode
- (NSString *)VLClocalizedLanguageNameForTwoLetterCode
{
return [[NSLocale currentLocale] displayNameForKey:NSLocaleLanguageCode value:self];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment