Friday, April 20, 2012

NSLocalizedString only retrieves the key, not the value in Localizable.strings (IOS)

I've made a strings file named "Localizable.strings" and added two languages to it, like so:



"CONNECTIONERROR" = "Check that you have a working internet connection.";
"CONNECTIONERRORTITLE" = "Network error";


I have also converted the files to Unicode UTF-8
However, when I create a UIAlertView like this:



 UIAlertView *myAlert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"CONNECTIONERRORITLE",nil)
message:NSLocalizedString(@"CONNECTIONERROR",nil)
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];


the alert view only shows the key text, not the value. It works if I, for example, set a UITextviews text to NSLocalizedString(@"CONNECTIONERROR",nil), but the alert view only displays the key. Anyone know what's wrong?





No comments:

Post a Comment