Lately I have been writing an iPhone application that needs to work in English and Turkish.
I used NSLocalizedString macro all across my code, then ran 'genstrings' from command-line to generate the Localizable.strings file with the key-value pairs.
In XCode, I selected Localizable.strings, hit the 'Info' button and then hit the 'Make file localizable' button. I then used the 'Add Localization' to add 'tr' support. I updated the Turkish version of the file with translated strings.
It all looked good when I tested on the simulator. Pretty cool. But while testing on the actual device, I noticed that the strings were not being replaced with their Turkish translations.
iPhone documentation says the Localizable.strings file needs to be in UTF-16 encoding. But suprisingly, if you are using SDK 2.2, the file generated when you hit the 'Add Localization' button is in UTF-8 encoding. So just because you added the original Localizable.strings file in XCode by specifying UTF-16 econding, do not assume that XCode will stick to that for its localized copies. To change the file's encoding to UTF-16 from UTF-8, use 'View' --> 'Text' --> 'File Encoding' in XCode menu.
'Clean', 'Build', and it all works!
Wow, thanks!
ReplyDeleteThanks, you made my day!
ReplyDeleteThank you! You saved us hours!
ReplyDeleteI never would have figured that out. Thanks!!
ReplyDeleteWow. I was about to go nuts over this. Thanks a lot!
ReplyDeleteThanks a ton.
ReplyDeleteThanks a lot man! :-)
ReplyDeleteHey very cool site!! Man .. Excellent .. Amazing .. I
ReplyDeletewill bookmark your blog and take the feeds also? I'm happy to seek out a lot of useful info here within the publish, we'd
like develop more techniques in this regard, thanks for sharing.
. . . . .
Look into my web site: homemade toys for toddlers
I know this if off topic but I'm looking into starting my own weblog and was wondering what all is required to get setup? I'm assuming having a blog like yours would cost a pretty penny?
ReplyDeleteI'm not very internet savvy so I'm not 100% positive. Any tips or advice would be greatly appreciated. Thank you
My web site heart beat