|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On 8/2/04 3:30 PM, Paul Ravish didst favor us with:_______________________________________________
On Aug 2, 2004, at 3:21 PM, Laurence Harris wrote:
On 8/2/04 3:00 PM, Paul Ravish didst favor us with:
Hi All,
I'm writing a Print Dialog Extension on Panther (10.3.2). I can't seem
to get the localized strings out of my bundle. I've tried the
following:
CFCopyLocalizedStringFromTableInBundle ( CFSTR("Color Presets:"),
CFSTR("Localizable"), MyGetBundle(), CFSTR("the custom pane title"));
CFCopyLocalizedString( CFSTR("Color Presets:") );
will do the same thing and make your code easier to read.
Does CFCopyLocalizedString(...) work with plugins or applications? Or
doesn't it matter?
Definitely with applications, but indeed you probably need to specify the
bundle if you're a plug-in. In that case I'd use something like the
following:
#define CopyMyLocalizedString(key) \
CFBundleCopyLocalizedString(MyGetBundle(), (key), (key), NULL)
But then, I prefer simpler, cleaner code to read so I try to minimized the
amount of unnecessary information in my code. Still, no matter how you try
to load the strings, if the strings file has any errors in it (such as
missing semicolons), CFBundleCopyLocalizedString() is going to return the
key as the string for *all* strings in that file.
<FWIW>
Some people use the string itself as the key. I think most of Apple's
applications do that as a matter of fact. Personally, I prefer to use much
shorter keys. Not only does it make the strings file smaller, it makes it
immediately obvious if CFBundleCopyLocalizedString() fails to find a string.
</FWIW>
Larry
Thanks,
--Paul Ravish
the CFStringRef returned has the string "Color Presets:" in it.
CFBundleCopyLocalizedString(MyGetBundle(), CFSTR("Color Presets:"),
CFSTR("the custom pane title"), CFSTR("Localizable"));
the CFStringRef returned has the string "the custom pane title" in it.
CFCopyLocalizedString( CFSTR("Color Presets:"), "This is the comment"
);
the CFStringRef returned has the string "Color Presets:" in it.
In my "Localizable.strings" file inside my bundle I have the line for
the Color presets setup to be
"Color Presets:"="The Color Presets:"
each string should be terminated with a semicolon:
"Color Presets:"="The Color Presets:";
The Localized.strings file is in UTF-16 format.
So clearly each result from above is wrong. What is the best way to
debug getting localized strings from a bundle? Is there any APIs that
I
can use to find out why CoreFoundation is failing to find and/or get a
strings out of my bundle? Any suggestions to fix this problem would be
greatly appreciated.
If anything in your strings file is wrong, all of those APIs will
simply
return the key.
Larry
Larry
| References: | |
| >Re: Problems Getting localized strings.... (From: Laurence Harris <email@hidden>) |
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.