为什么ibtool无法将UTF-16字符串文件导入nib?
我对 ibtool 和本地化有一个非常奇怪的问题: 我使用此命令导出字符串文件:
ibtool --export-strings-file XibLoc.strings SomeXib.xib
然后我尝试将字符串导入到 Xib 文件中以生成本地化版本:
ibtool --strings-file XibLoc.strings --write NewXib.xib SomeXib.xib
这是 xib 本地化的一种非常标准的技术,但是它会抛出错误:
<?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>
那么这是什么 WTF? ibtool 以 UTF-16 编码导出数据,结果即使我没有更改导出文件中的任何内容,也无法将其导入回来。有谁知道那里发生了什么事吗?或者我做错了什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ibtool 对文件参数语法过于挑剔。在 ibtool 5.0 中情况甚至变得更糟。请参阅/欺骗我的雷达。
让它为我工作的唯一方法(假设您的本地化提供了主 XIB)是:
不要在路径名中添加任何引号或“..”等,因为 ibtool 在这种情况下可能会失败。
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:
Don't add any quotes or ".." etc. to the path names since ibtool might fail in this case.