Xcode Localization Not Working?

不问归期 提交于 2020-01-03 16:22:41

问题


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:


  1. Perform build clean ( Command-Option-Shift-K)
  2. Remove the app from simulator/device
  3. 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.




回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!