0
iPhone 용 앱을 만들었습니다. 이 사용자는 버튼 클릭시 언어를 변경할 수 있습니다. NSLoalizedString은 값을 변환하지 않습니다.iPhone에서의 현지화가 버튼 클릭에서 작동하지 않습니다.
코드는
-(IBAction)btn1pressed:(id)sender {
SecViewController *sec = [[SecViewController alloc] initWithNibName:@"SecViewController" bundle:nil];
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
// NSLog(@"%@", [userDefaults objectForKey:@"AppleLanguages"]);
languages [email protected]"en";
[[NSUserDefaults standardUserDefaults] setObject:languages forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"%@", [userDefaults objectForKey:@"AppleLanguages"]);
// NSLog(@"%@", NSLocalizedString(@"Subhash", nil));
[self.navigationController pushViewController:sec animated:YES];
}
-(IBAction)btn2pressed:(id)sender {
SecViewController *sec = [[SecViewController alloc] initWithNibName:@"SecViewController" bundle:nil];
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
// NSLog(@"%@", [userDefaults objectForKey:@"AppleLanguages"]);
languages = @"es";
[[NSUserDefaults standardUserDefaults] setObject:languages forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"%@", [userDefaults objectForKey:@"AppleLanguages"]);
// NSLog(@"%@", NSLocalizedString(@"Subhash", nil));
[self.navigationController pushViewController:sec animated:YES];
}
-(IBAction)btn3pressed:(id)sender {
SecViewController *sec = [[SecViewController alloc] initWithNibName:@"SecViewController" bundle:nil];
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
// NSLog(@"%@", [userDefaults objectForKey:@"AppleLanguages"]);
languages [email protected]"ja";
[[NSUserDefaults standardUserDefaults] setObject:languages forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"%@", [userDefaults objectForKey:@"AppleLanguages"]);
// NSLog(@"%@", NSLocalizedString(@"Subhash", nil));
[self.navigationController pushViewController:sec animated:YES];
}