localizable.strings - works in simulator but not on device

半腔热情 提交于 2019-12-14 02:12:13

问题


I have a problem with my language. I only see the ID_String on my device for each entry defined with NSLocalizedString. All text/images etc. set in the storyborad are shown correctly. If I use the simulator everything is fine!

So, I would like to youse NSLocalizedString - to use the option to translate my app maybe later. At this time my app is in german only.

  • I use storybord option. In the options I set the Localization to Germany
  • I add a string file to my project, also with the german localization
  • all lines in this file looks like "OK_Button" = "OK";

In my project folder there is an de.lproj folder including the storybord, InfoPlist.strings and localizable.strings

The two stings are saved as UTF16. I open these files in TextWrangler and savend them again.

I search since a few days for the reason, but I dont see my problem. Have anyone an idear whats wrong, or whats missing in my code?


回答1:


One reason that something works on the simulator, but not on the device is that Max OS X uses case-insensitive file systems by default, but iOS uses a case-sensitive file system. Check to make sure that your case for the filename is "Localizable.strings".




回答2:


Another reason for the problem could be that there is a Localizable.strings file in Base.lproj directory. It causes the iPhone to use the Base translation file instead of the correct translation file.

see: Creating Strings Files for User-Facing Text in Your Code



来源:https://stackoverflow.com/questions/9362215/localizable-strings-works-in-simulator-but-not-on-device

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