Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>it can be done easily although it took me weeks to work out how ;-)</p> <p>I have an iPhone app called iDEX which is a Romanian dictionary. On the iPad, Romanian is not available as a UI language, so I wanted to give the user the option of selecting Romanian in the application settings, as the device settings do not include it.</p> <p>What you have to do is internationalize the app and localize it as usual. Then, <strong><em>in the main method</em></strong>, set the <code>AppleLanguages</code> key of the standard <code>NSUserDefaults</code> to the language and country of your choice, like so</p> <pre><code>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; } </code></pre> <p>It is <strong>imperative</strong> that you set the <code>AppleLanguages</code> key <strong>before</strong> you run <code>UIApplicationMain()</code>, because it is at that point that the UIKit framework is loaded and the default language determined.</p> <p>It also important that you specify both language and country (eg, @"ro_RO" and not just @"ro") otherwise your app might crash when setting the key.</p> <p>By doing this, all calls to <code>NSBundle</code> that support localization will look for the language that you have programatically established, as opposed to the one set on the device.</p> <p>Hope that helps...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload