1
votes

I localized a text file in my application that currently is only supported in English enter image description here

I'm using this code to get the path:

 [[NSBundle mainBundle] pathForResource:@"Quotes" ofType:@"txt"]

On my system (Lion 10.7.2) it returns the expected path (English) when on any language

build/Beta/MyApp.app/Contents/Resources/en.lproj/Quotes.txt

But for some international users, this code is returning nil. I have not yet confirmed it but currently its only happened to Snow Leopard users.

Any Ideas? Thank you.

Edit:

  • Mac OSX 10.7.2 German
  • Snow Leopard English
  • Mac 10.6.8 German
  • Mac OSX 10.7.2 Chinese

Snow leopard theory is gone also, there is an English mac that also returns nil, this is confusing.

1
Have you tried + (NSBundle *)bundleWithIdentifier:(NSString *)identifier method? - Parag Bafna
Do you mean to check if its returning the correct bundle? - the Reverend

1 Answers

1
votes

I got it, I have a workspace including ios & mac projects both sharing this file. But the ios version has the value "en" on Localization native development Region key in info.plist and the Mac has "English" I changed the Mac project to "en" and updated all the localized files.

Users that did not have "English" in their list language on System Preference -> Language & Text where getting nil.

Credit goes to Ken Thomases from the Apple Forums