.strings
files and the NSLocalizedString()
family of macros. (If not, then look here.)One small but important fact that I didn't find documented was the required text encoding for
.strings
files. I assumed that UTF-8 would work fine, and indeed, the iPhone simulator is happy with UTF-8 encoding. Unfortunately a real phone (running iPhone OS 2.2) silently ignores UTF-8 encoded .strings
files. Seems that UTF-16 encoding is required.You can convert a file in Xcode by ctrl-clicking in it, selecting Get Info and changing the File Encoding: drop-down and click the Convert button in the file encoding dialog.
Strangely enough however, the
InfoPlist.strings
file works fine whether encoded as UTF-8 or UTF-16, but it's probably best to be consistent and encode all your .strings
files as UTF-16. Also, the genstrings
utility only writes out .strings
files as UTF-16, so it seems like the way to go.
1 comment:
Thanks a lot for the post. This has saved me LOT os trouble. Thanks again.
Post a Comment