Re: Localizable.strings not being read...
Re: Localizable.strings not being read...
- Subject: Re: Localizable.strings not being read...
- From: "Mr. Gecko" <email@hidden>
- Date: Thu, 3 Feb 2011 14:22:37 -0600
I just figured out what it was.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSLog(@"%@", [[NSBundle bundleForClass:[self class]] bundlePath]);
NSLog(@"%@", [[NSBundle bundleForClass:[self class]] pathForResource:@"Localizable" ofType:@"strings"]);
NSLog(@"%@", NSLocalizedStringFromTableInBundle(@"Upload File", @"Localizable", [NSBundle bundleForClass:[self class]], nil));
}
That's my test, and this is my output.
AppName.app
AppName.app/Contents/Resources/Localizable.strings
Upload File
If you look at the path for the localizable strings that it found, it's not the localized one. This was caused because I was building the strings file manually and by doing it manually, I built with it not localized and when I made it localized, it kept the old strings in the main directory. Obviously a fix would be to clean all and rebuild. I am saying this for people who also encounter this problem.
Note: I'm not mentioning the name of the app as it's not important and I don't want to advertise.
On Feb 3, 2011, at 12:40 PM, Uli Kusterer wrote:
> On 03.02.2011, at 19:33, Mr. Gecko wrote:
>> Hello, I'm having a problem where NSLocalizableString isn't working in one of my projects but it is working perfectly fine in a test project made just to verify it is the project. I copied the same strings from one project to the other and it all works... Has anyone experienced this problem? If so, have you found a fix? This project is complete and I don't really want to build the project file to get it working. Could it be a problem in info.plist?
>
> What kind of project is it? Application? Loadable bundle? Strings are looked up from the main bundle by default, which is the application, not the loaded bundle. That's a common issue that trips people up. You may have to explicitly specify the bundle (e.g. using bundleForClass:).
>
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.zathras.de
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden