I have a very strange issue with ibtool and localizations: I used this command to export the stringsfiles:
ibtool --export-开发者_如何学运维strings-file XibLoc.strings SomeXib.xib
then I tried to import the strings into a Xib file to produce localized version:
ibtool --strings-file XibLoc.strings --write NewXib.xib SomeXib.xib
This is a pretty standard technique for xib localization, however it spits an error:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.ibtool.errors</key>
<array>
<dict>
<key>description</key>
<string>The stringsfile XibLoc.strings does not appear to contain valid data for UTF-16 string encoding.</string>
</dict>
</array>
</dict>
</plist>
So WTF is that? ibtool exports data in UTF-16 encoding, and turns out it can not import it back even if I don't even change anything in the exported file. Does anyone know what's going on there? Or what am I doing wrong?
ibtool is overly picky with the file argument syntax. It even got worse in ibtool 5.0. See/dupe my Radar on this.
The only way to get it working for me (assuming your en localization provides the master XIB) is:
cd <project folder>
ibtool --strings-file fr.lproj/SomeXib.strings --write fr.lproj/SomeXib.xib en.lproj/SomeXib.xib
Don't add any quotes or ".." etc. to the path names since ibtool might fail in this case.
精彩评论