this can be done easily, although it took me weeks to figure out how :-)
I have an iPhone app called iDEX, which is Romanian. On the iPad, Romanian is not available as the user interface language, so I wanted to give the user the opportunity to choose Romanian in the application settings, since the device settings do not include it.
What you need to do is internationalize the application and localize it as usual. Then in the main method , set the AppleLanguages key of the standard NSUserDefaults to the language and country of your choice, for example
int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:[NSArray arrayWithObject:@"ro_RO"] forKey:@"AppleLanguages"]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool drain]; return retVal; }
UIApplicationMain() , because it is at this point that the UIKit infrastructure is loaded and is determined by language by default.
It is also important to specify both the language and the country (for example, @ "ro_RO", and not just @ "ro"), otherwise your application may crash when you install the key.
That way, all NSBundle calls that support localization will look for the language you programmed, not the one that is installed on the device.
Hope this helps ...
source share