CFCopyLocalizedString returns keyStr

Discussion in 'Mac Programming' started by zeppenwolf, Apr 18, 2010.

  1. zeppenwolf macrumors regular

    zeppenwolf

    Joined:
    Nov 17, 2009
    #1
    I'm probably missing something really silly, but why doesn't this work?

    CFStringRef newname;
    newname = CFCopyLocalizedString( CFSTR("CFBundleShortVersionString"),
    CFSTR ("no comment") );

    newname obtains the value "CFBundleShortVersionString", not "MyApp version blah"...

    CFBundleShortVersionString is defined in the default InfoPlist.strings, of course, created by PB when the project was created, so I doubt that there can be a problem with the formatting in there, or invisible control characters, etc...

    ???
     
  2. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #2
    Try one of the routines that starts with "CFBundle..."
     
  3. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    From the docs:
    If you want to get a localized string from a .strings file other than Localizable.strings, use CFCopyLocalizedStringFromTable.
     
  4. zeppenwolf thread starter macrumors regular

    zeppenwolf

    Joined:
    Nov 17, 2009
    #4
    Actually, I was using one. From CFBundle.h :

    #define CFCopyLocalizedString(key, comment) \
    CFBundleCopyLocalizedString(CFBundleGetMainBundle(), (key), (key), NULL)


    But creating "Localizable.strings" gets it to work. Thanks!!
     

Share This Page