I used this code in Objective C
to change language in a PickerView
:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.dicke = [[NSArray alloc]
initWithObjects:@"0.0",@"0.5",@"1.0",@"1.5",@"2.0",@"2.5",@"3.0",@"4.0",@"5.0",@"6.0",@"8.0",@"10.0",@"12.0",@"15.0",@"20.0", nil];
NSString *userLocale = [[NSLocale currentLocale] localeIdentifier];
NSLog(@"%@", userLocale);
if ([userLocale isEqualToString:@"de_DE"]) {
self.Material = [[NSArray alloc]
initWithObjects:@"Stahl",@"Aluminium",@"Edelstahl",@"Kupfer", nil];
}
else
self.Material = [[NSArray alloc]
initWithObjects:@"Steel",@"Aluminum",@"Stainless",@"Copper", nil];
}
How can i do this in Swift
, or is there another way to translate text in a PickerView
. Sorry for this stupid question but I´m really a beginner with Swift
.