Localisation_setting.bundle

Just wanted to ask how to localize Xibs via settings.bundle? Actually, I need to make my Xib arabic through settings.bundle. I searched a lot for this. Please give me the right suggestions, otherwise I need to copy my application and delete all the Xibs content and do it with encoding, which will take a lot of time.

Thanx in advance.

+4
source share
5 answers

Hey, just paste this following code into the main.m file

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *strLang=[[NSUserDefaults standardUserDefaults] stringForKey:@"PSMultiValueSpecifier"]; NSLog(@"Hi%@",strLang); // if ([strLang isEqualToString:@"0"]) { [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"AppleLanguages"]; [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", @"ar", nil] forKey:@"AppleLanguages"]; [[NSUserDefaults standardUserDefaults]synchronize]; } else if([strLang isEqualToString:@"1"]) { [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"AppleLanguages"]; [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"ar", @"en", nil] forKey:@"AppleLanguages"]; [[NSUserDefaults standardUserDefaults]synchronize]; } int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; 
0
source

I followed this post to localize applications.

0
source

you can localize the nib file by saving the xib file in a specific language folder, for example. en.lproj/View1.xb - the English version as well as ar.lproj/View.xib - the Arabic version for more detailed instructions see this

UPDATE: for this you just create

  • View-en.xib
  • View-ar.xib

and then based on user preferences

 NSString *xibName = [NSString stringWithFormat:@"View-%@", @"en"]; id localVC = [[LocalViewController alloc] initWithNibName:xibName bundle:nil]; 
0
source

click "get information" by right-clicking on the xib that you want to localize ... and on the general screen you can see the "Make file localizable" button.

0
source

@aamritrao, if you create two separate XIB files, one for each language, you should not give them different names, as this just complicates things unnecessarily. Just name them the same, but put them in different localized project folders.

So:

en.lproj / View1.XIB

and

ar.lproj / View1.XIB

Then, when your application requires View1.XIB, it will always use the appropriate one for the language that the user has set in the settings of his device.

Sorry if this is not what you are looking for. Not sure what you mean by “Localization through a set of settings” ... could you explain more?

0
source

Source: https://habr.com/ru/post/1341961/


All Articles