NSLocalizedString only returning key [solved]


#1

Odd. When I used:

NSAlert *alert = [NSAlert 
alertWithMessageText:NSLocalizedString(@"REMOVE_MSG", @"Remove") 
defaultButton:NSLocalizedString(@"REMOVE", @"Remove") 
alternateButton:NSLocalizedString(@"CANCEL", @"Cancel") 
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"REMOVE_INF", @"%d people will be removed"), 
 [selectedPeople count]] ;

After running the app, I only ever got back the KEY from the strings tables… I did a little research and found this to fix it:

    NSAlert *alert = [NSAlert
                      alertWithMessageText:NSLocalizedStringFromTable(@"REMOVE_MSG", @"localizable", @"Remove")
                      defaultButton:NSLocalizedStringFromTable(@"REMOVE", @"localizable", @"Remove")
                      alternateButton:NSLocalizedStringFromTable(@"CANCEL", @"localizable", @"Cancel")
                      otherButton:nil
                      informativeTextWithFormat:NSLocalizedStringFromTable(@"REMOVE_INF", @"localizable", @"%d people will be removed"),
                      [selectedPeople count]] ;

Where:

NSLocalizedStringFromTable(@“key”, @“stringTableFileName”, @“Comment”);

i.e. the localizable files were called Localizable.string, you leave the string off and just use the work Localizable. Worked perfectly after I made this change…

FYI, I’m using XCode - Version 4.6 (4H127)

Did anyone else notice this behavior?