views:

791

answers:

4

Hi,

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?

A: 

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

mcandre
On the sim I use Simulator - Debug. For the device I use Device - Development. I don't see a check mark next to the file. Never seen a check next to a file before. There is none next to sounds.plist.
Steve
A: 

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.

Steve
A: 

Thanks for the tip, I seem to have the same problem and will check it out.

Axel Roest
A: 

I have a similar problem. What I believe is happening is that when the app is updated, the older files aren't being deleted. In my situation, I have a XIB that used to be in the app root. Then when localizing, I moved everything to their respective localized directories. When I update an older version of my app, it appears the previous version of the XIB isn't being deleted and it picks up that one first. If I delete the app and reinstall, it works fine.

Any ideas how to solve this without renaming the XIB (which does work but will just make things a headache for going forward)? Ray

ray