I've got a plist which I localized. How do I load the plist properly?
Right now, I'm using this code:
NSArray *numbersArray = [[NSArray alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"Numbers" ofType:@"plist"]];
What do I need to change my code to in order to load the localized plist?
NSArray *numbersArray = [[NSArray alloc]
initWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"Numbers" ofType:@"plist"]];
This should work provided that you assure that you have the following bundle layout:
MyApp.app
// no Numbers.plist here
.....
en.lproj/
Numbers.plist // english-version
fr.lproj/
Numbers.plist // french-version
The important thing is that you do not have a Numbers.plist
file at the root level (aka-non-localized level) of the bundle, since if you do, that Numbers.plist will always take precedence over the localized version (for performance reasons).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With