• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CFBundleCopyLocalizedString does not work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFBundleCopyLocalizedString does not work


  • Subject: Re: CFBundleCopyLocalizedString does not work
  • From: Giacomo Tufano <email@hidden>
  • Date: Wed, 7 Oct 2009 17:57:51 +0200

I had the same problem (compiling for iPhoneOS). In my case, the culprit was that the encoding of Localizable.string was UTF-8. It must be UTF-16. With UTF-8, the call was silently failing...
My 2€cents,
gt

Il giorno 07/ott/2009, alle ore 16.35, Dieter Oberkofler ha scritto:

The problem is that IÄm unable to retrieve (locate) the string resource file always just get the default value.
I'm aware of the fact that when using NULL or an empty default string it returns the key but the problem is that I never actually get the value in the file and can't figure out why.
Thank you,
-Dieter

On 07.10.2009, at 16:26, Glenn L. Austin wrote:

On Oct 7, 2009, at 7:19 AM, Dieter Oberkofler wrote:

I'm new to localized string resources and seem unable to properly use CFBundleCopyLocalizedString.
As this seems to be a very common reason for troubles, I have double checked the format of the *.string resource file using plutil and the file itself seems to be ok.
I therefore guess that I'm just not properly locating the *.strings resource file and would need some help on how to trace this.
I load the string resources using something like:
CFBundleCopyLocalizedString(CFBundleGetMainBundle(), CFSTR("TEST"), CFSTR(""), CFSTR("Localizable"));"
I actually don't care about localization (for the moment) so I've put my resource file (Localizable.strings) to a directory Contents/Resources/English.lproj.
Is this correct or do I somehow need to specify where the string resources have been put?
Can I somehow find out where CFBundleCopyLocalizedString  is looking for the string resources?
Can I somehow hard-code where to look for the string resurces?
Any help is appreciated!

What is the problem that you're having?

I'm guessing that you're getting back CFSTR("TEST") instead of CFSTR("") -- if you look at the documentation for that routine, that is the documented behavior. NULL or an empty string returns the key.

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver         <><
<http://www.austin-soft.com>


Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >CFBundleCopyLocalizedString does not work (From: Dieter Oberkofler <email@hidden>)
 >Re: CFBundleCopyLocalizedString does not work (From: "Glenn L. Austin" <email@hidden>)
 >Re: CFBundleCopyLocalizedString does not work (From: Dieter Oberkofler <email@hidden>)

  • Prev by Date: Memory corruption when going from 10.5 to 10.6
  • Next by Date: Re: Building a static library for the iPhone
  • Previous by thread: Re: CFBundleCopyLocalizedString does not work
  • Next by thread: Building a static library for the iPhone
  • Index(es):
    • Date
    • Thread