Alex75
Alex75

Reputation: 517

xcode 5 localization failed

I have a curious problem ...

I created a new project with xcode 5 , I deleted storyboards , since i'm working with xibs , and I removed the base localization because , from what I've read, it's useless with the xibs . I also eliminated the English localization and added the Italian one , which is what interests me.

I started working with the device (which is set in Italian ) and everything works properly.

This morning , having forgotten the cable at home, I decided to use the simulator (which is set in English) and the app crashed . After some tests I realized that the problem stems from the language settings , in fact if I set the language of the simulator in Italian , everything works properly. Analyzing the situation better , I realized that some variables set in the file " Localizable.strings " and crucial for the application are not read correctly ( it sets the key and not the value ) and for this reason the app crashes .

I'm pretty confident i can solve the problem by simply creating a new project and copying in the code, but I would like to know if it is possible to recover the original.

Any help will be appreciated thanks

EDIT:

1st Try: Checked the button base localization in project/info is opening an empty popup window (no files to localize)

2nd Try: In project/info, under localization press "+" to add base localization (i have only italian now) seems nothing changed ... it still open an empty window

Follow some screenshots

The Italian Localization

As u can see there is 1 file localized, wich is the Localizable.strings, and the check button "Use base Internationalization" unchecked.

Base Localization Window

Here u can see what happen either when i check "Use base Internationalization" or i add the Base language by pressing the "+" button under "Localizations".

EDIT 2:

Tryed same things with iOS Deployment Target 7.0 instead of 4.3. Same Result

Upvotes: 1

Views: 5192

Answers (3)

user3301325
user3301325

Reputation: 51

Your problem is likely that the MainMenu.xib needs to be registered as a localizable resource.

  1. Select MainMenu.xib in the Project Navigator (left sidebar)
  2. If a Localize... button appears in the File Inspector (right sidebar), press it.
  3. Tick the Use Base Internationalization checkbox. This time MainMenu.xib should appear.

Now when you tick additional languages for MainMenu.xib in the File Inspector, Xcode will create a MainMenu.strings file for that language. Click the disclosure triangle on MainMenu.xib in the Project Navigator to edit it.

Upvotes: 1

Alex75
Alex75

Reputation: 517

Resolved. The problem arose from the fact that I had installed on the simulator an old version of Localizable.strings file as indicated in the post here.

The strange thing is that I was pretty sure I deleted and restarted the app more times before I read that post, as it is a practice that I adopt often well aware of the behavior described in the post.

Edit:There was no need, as I thought, add the Base Localization

Upvotes: 1

Peter Segerblom
Peter Segerblom

Reputation: 2813

When working with Localization you need a base language, one that can be used if the language the device wants to use is not present. If no file can be found it will use the key. One trick, since keys can be a sentence, is to let your key be the your base language.

Upvotes: 0

Related Questions