问题
I am trying to add a new localization for my app for Mac OS X (Mountain Lion).
I added the appropriate localizations to the project info panel and made all the .xib
files localized. I also added and translated the .strings file and replaced the .xib files with the translated strings file.
Then everything seemed to be working, and the interface builder showed appropriate translations for each localization xib
file. However, when I actually run the app, it is shown in English, although the default language for my system is not English.
I also have a Localizable.strings
file for some of the labels, and for those that I used NSLocalizedString
works fine.
I'm not sure what I am missing here?
Thanks in advance.
回答1:
- Perform build clean ( Command-Option-Shift-K)
- Remove the app from simulator/device
- Launch the app
回答2:
Check that you marked Target Membership of your Target. I had the same problem, because I had add my string manually.
Look at the image.
![](https://i0.wp.com/i.stack.imgur.com/UOtgz.png)
回答3:
In my case, it didn't work because the UILabel text was set as "Attributed" instead of "Plain" in the Attributes Inspector. Localization with a .strings file doesn't seem to work on Attributed strings. I even had a storyboard with mixed Plain and Attributed string labels, and the localization only worked on the Plain ones.
Also, check that there are no syntax errors in your Localizable.strings (end each line with ";")
来源:https://stackoverflow.com/questions/14037753/xcode-localization-not-working