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

Prefix NSString extension

parent 9fafcd21
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
if ([preferredLanguage containsString:@"-"]) { if ([preferredLanguage containsString:@"-"]) {
preferredLanguage = [[preferredLanguage componentsSeparatedByString:@"-"] firstObject]; preferredLanguage = [[preferredLanguage componentsSeparatedByString:@"-"] firstObject];
} }
selectedLocale = [preferredLanguage threeLetterLanguageKeyForTwoLetterCode]; selectedLocale = [preferredLanguage VLCthreeLetterLanguageKeyForTwoLetterCode];
/* last resort */ /* last resort */
if (selectedLocale == nil) { if (selectedLocale == nil) {
selectedLocale = @"eng"; selectedLocale = @"eng";
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
} else { } else {
NSString *selectedLocale = [[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingLastUsedSubtitlesSearchLanguage]; NSString *selectedLocale = [[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingLastUsedSubtitlesSearchLanguage];
cell.textLabel.text = NSLocalizedString(@"LANGUAGE", nil); cell.textLabel.text = NSLocalizedString(@"LANGUAGE", nil);
NSString *detail = [[selectedLocale twoLetterLanguageKeyForThreeLetterCode] localizedLanguageNameForTwoLetterCode]; NSString *detail = [[selectedLocale VLCtwoLetterLanguageKeyForThreeLetterCode] VLClocalizedLanguageNameForTwoLetterCode];
cell.detailTextLabel.text = detail ? detail : selectedLocale; cell.detailTextLabel.text = detail ? detail : selectedLocale;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
} }
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
@interface NSString (LocaleCodes) @interface NSString (LocaleCodes)
- (NSString *)twoLetterLanguageKeyForThreeLetterCode; - (NSString *)VLCtwoLetterLanguageKeyForThreeLetterCode;
- (NSString *)threeLetterLanguageKeyForTwoLetterCode; - (NSString *)VLCthreeLetterLanguageKeyForTwoLetterCode;
- (NSString *)localizedLanguageNameForTwoLetterCode; - (NSString *)VLClocalizedLanguageNameForTwoLetterCode;
@end @end
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
@implementation NSString (LocaleCodes) @implementation NSString (LocaleCodes)
- (NSString *)twoLetterLanguageKeyForThreeLetterCode - (NSString *)VLCtwoLetterLanguageKeyForThreeLetterCode
{ {
NSDictionary *searchDict = @{@"alb" : @"sq", NSDictionary *searchDict = @{@"alb" : @"sq",
@"ara" : @"ar", @"ara" : @"ar",
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
return searchDict[self]; return searchDict[self];
} }
- (NSString *)threeLetterLanguageKeyForTwoLetterCode - (NSString *)VLCthreeLetterLanguageKeyForTwoLetterCode
{ {
NSDictionary *searchDict = @{@"sq" : @"alb", NSDictionary *searchDict = @{@"sq" : @"alb",
@"ar" : @"ara", @"ar" : @"ara",
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
return searchDict[self]; return searchDict[self];
} }
- (NSString *)localizedLanguageNameForTwoLetterCode - (NSString *)VLClocalizedLanguageNameForTwoLetterCode
{ {
return [[NSLocale currentLocale] displayNameForKey:NSLocaleLanguageCode value:self]; 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