Question

I have an iPhone localization problem that has me perplexed. I was localizing my app and had English as well as simplified and traditional Chinese working fine. I have two files, Localizable.strings and sounds.plist which have been localized. Strings in both files appeared correctly on the device and emulator.

Now yesterday I am adding Spanish, Italian and German. When I test in the emulator, everything displays correctly. But when I deploy to the device, the strings contained in Localizable.strings display correctly, but the strings contained in sounds.plist always display in English. Even the Chinese strings stopped appearing correctly.

I've tried cleaning the builds, copying the translated text back into the sounds.plist files, and even nuking the files, deleting the lproj folders, removing the localizations and starting over.

I set a breakpoint in XCode and it seems like for this file, it is not detecting the loc folder. The code that loads the strings from sounds.plist is:

+ (NSDictionary*) getSounds
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"sounds" ofType:@"plist"];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
return dict;
}

I have verified that the file name is sounds.plist, all in lower case. At this point, I'm at a loss. Has anyone experienced anything like this? Does anyone have suggestions on how to fix?

Thanks!

UPDATE: I have compared the results of the following line on the simulator as well as the device:

NSString *path = [[NSBundle mainBundle] pathForResource:@"sounds" ofType:@"plist"];

On the simulator, the path is correctly reported as /Users/Steve/.../de.lproj/sounds.plist. On the device, the path is reported as /var/mobile/.../sounds.plist. Note that de.lproj is not in the path. So it's loading sounds.plist from the root, which explains why the text doesn't appear localized. Now my question is why doesn't the code get the path to the file in the localized folder?

Was it helpful?

Solution 2

The problem was something was messed up on the device. I uninstalled the app from the device using the Organizer, and then re-installed via XCode. Everything is working nicely now.

OTHER TIPS

Is there a check next to the sounds.plist file in Xcode? Are you in debug or release mode?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top