Paul Morris
Paul Morris

Reputation: 1773

Experiencing An Issue With Localizable.strings in an iOS iPad App

This is the first time that I have attempted to add some localization into an app using Localizable.strings files and I am experiencing an unexpected issue with it. For clarity, these are the steps I have gone through.

  1. File >> New >> New File and added a Resources file of Strings type.
  2. Named the file 'Localizable.strings'
  3. Clicked into the Localizable.strings file and added Spanish through the Localization section. (I have confirmed in my project folder that I have the en and es folders).
  4. Started to add my KEYS in the Localizable.strings (English) file and then add the Spanish translation into the Spanish file.

As an example, this is one of the localizations I am trying to add.

"CAMERA_ERROR" = "The device does not have a camera";

I am added the exact same string in the Spanish .strings file, but changing the text to suit Spanish. Within my app code I am using the following:

NSString *cameraError = NSLocalizedString(@"CAMERA_ERROR", nil);

Everything seems fine up until this point, but this is where it gets weird and I get confused. If I run the app on one of my iMacs it works fine and depending on what language I set the simulator to it displays the correct English or Spanish string.

However, when I run the exact same app on this MacBook Pro it doesn't display the string, it instead takes the "KEY" title and displays that. So instead of showing the message as "The device does not have a camera" it shows it as "CAMERA_ERROR". The code is exactly the same as it is the same project cloned from a git repo.

Can anyone shed any light on this? Any setting on the MacBook that could be different?

Upvotes: 0

Views: 789

Answers (1)

sergio
sergio

Reputation: 69047

Try doing the following on your MacBook Pro:

  1. clean the project;

  2. remove the app from the simulator/device;

  3. rebuild the app.

This should fix it.

Upvotes: 6

Related Questions