I just thought I’d share something I ran across today with iOS 6 and UISwitch controls.
If you put a UISwitch in a XIB and expect the text inside of the UISwitch to appear in the right language, iOS 6 will look in your app’s (current region name).lproj
for a file named (same as xib).strings
.
For example, if I have a UI defined in SettingsViewController.xib
, and that UI has a UISwitch, and I want a Japanese user to see that switch’s on/off in Japanese, I need to make a file named ja.lproj/SettingsViewController.strings
. The strings
file doesn’t need to have anything in it, but it can’t be zero length. The easiest thing to do is just throw in something like:
1 2 3 |
/* * Just another file. */ |
And then convert that file to a binary plist using the plutil
command-line tool:
1 |
plutil -convert binary1 SettingsViewController.strings |
Note: don’t forget the ‘1’ in binary1
. More information on man plutil
.
If you’re developing exclusively within XCode 5, then I’d suggest just localizing any XIBs and let XCode do the magic for you.