NSArray *arrayOfSeperatedString = [currentLanguage componentsSeparatedByString:@"_"];
NSLog(@"%@", [arrayOfSeperatedString objectAtIndex:0]);
edit:
A better way would be:
NSLocale *currentLocale = [[[NSLocale alloc] initWithLocaleIdentifier:currentLanguage] autorelease]; //Sets the what laguage the language name and country name should be written in
NSString *displayNameString = [currentLocale displayNameForKey:NSLocaleIdentifier value:currentLocale]; //Sets what language you want written..
NSLog(@"The current language is: %@", displayNameString);
Now if the current language is french (fr_FR) this returns:
The current language is: français (France)
If the current language is english (en_US) this returns
The current language is: English (United States)
Now if you want to ommit the country name use componentsSeperatedByString:@" ("
as described above..