问题
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