After creating new cocoa application,I have added localization string files localizeFile.strings(English) and localizeFile.strings(Spanish)
In localizeFile.strings(English) file I added "TITLE" = "Hello!";
In localizeFile.strings(Spanish) file I added "TITLE" = "Hola!";
In my class I was trying to access the localized English text in actions with the following statements
-(IBAction)english:(id)sender
{
// NSString *engText = [[NSBundle mainBundle] localizedStringForKey:@"TITLE" value:@"" table:nil];
NSString *engText = NSLocalizedString(@"TITLE", nil);
NSLog(@"engText %@",engText);
[displayText setStringValue:engText];
}
-(IBAction)spanish:(id)sender
{
NSString *spanText = NSLocalizedString(@"TITLE", nil);
NSLog(@"spanText %@",spanText);
[displayText setStringValue:spanText];
}
Here displayText is NSTextField and two actions in the same window.
I have seen in the console ,engText TITLE instead of engText Hello on clicking the buttons.
Can somebody guide me how can I get localized strings?Please help