Seeking help with Localized strings (Hillegass' book, ch. 16)

Discussion in 'Mac Programming' started by HawaiiMacAddict, Jun 22, 2008.

  1. macrumors 6502a

    Joined:
    Dec 28, 2006
    Location:
    On one of my Macs of course
    #1
    Aloha everyone,

    I am working my way through Cocoa Programming for Mac OS X and have run into a major stumbling block. I've attached the screenshot from my program. Basically, I replaced a portion of one method with something almost identical, but the program no longer runs. Take a look at the attachment - can anyone see where I went wrong?

    Mahalo in advance for your assistance,

    HawaiiMacAddict
     

    Attached Files:

  2. macrumors regular

    Joined:
    Jan 18, 2006
    #2
    First of all, the following line is probably wrong.
    Code:
    otherButton:NSLocalizedString:nil
    I don't know a lot about localized strings, but you're probably going to have to do something like this. This is uncompiled, so it may not be correct either.
    Code:
    otherButton:NSLocalizedString(nil, nil);
    Secondly, you forgot a close parentheses in this line.
    Code:
    informativeTextWithFormat:NSLocalizedString(@"SURE_DELETE", @"Do you really want to delete %d people?", [selectedPeople count]];
     
  3. thread starter macrumors 6502a

    Joined:
    Dec 28, 2006
    Location:
    On one of my Macs of course
    #3
    Aloha white89gt,

    Thanks for the head's up on the missing paren. As for the first comment, I used nil in the commented out section (what was there previously) and it worked fine. When I completed the localization section, I had to modify the code. Instead of deleting the existing code, I simply commented it out and entered in the new code from the book. I also imported the Foundation class to the MyDocument.h file, but got the errors noted in the attached file.

    HawaiiMacAddict
     

    Attached Files:

  4. thread starter macrumors 6502a

    Joined:
    Dec 28, 2006
    Location:
    On one of my Macs of course
    #4
    Aloha white89gt,

    I finally figured out the problem. In the line you originally noted as not having the closing paren, I had also typed 'NSLocalizedString' which was unnecessary. Once I took it out, everything works normally. Thanks for giving my code a once-over.

    HawaiiMacAddict
     
  5. macrumors regular

    Joined:
    Jan 18, 2006
    #5
    No problem, and sorry I didn't catch the mis-spelling. When I saw the errors, I thought spelling might have something to do with it but I couldn't see that it was mis-spelled.
     

Share This Page