本地化无法读取字符串文件(Xcode 6.3.2) [英] Localization failed to read a strings file (Xcode 6.3.2)
问题描述
我无法导出本地化文件,只是出现无法读取字符串文件的本地化文件"错误.
I can't export for localization, I just get a "Localization failed to read a strings file" error.
系统日志显示:
2015-06-07 01:41:48,305 Xcode[1914]: [MT] DVTAssertions: Warning in /SourceCache/IDEFrameworks/IDEFrameworks-7718/IDEFoundation/Localization/IDELocalizationWork.m:434
Details: Failed to read strings file "/var/folders/vh/z7jrdtc16mv_ml4rdf3c_yf40000gn/T/Xcode3SourceStringsAdaptor-8B1BF14F-E8BF-4354-9FB6-BFF843BD6623/Localizable.strings", underlying error:
The data couldn’t be read because it isn’t in the correct format.
Object: <IDELocalizationWork>
Method: +readStringsWorkForContext:
Thread: <NSThread: 0x7fa8a250a200>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
但是我不知道"Localizable.strings"是什么文件. 这些步骤不起作用:
But I have no idea what file "Localizable.strings" is. These steps didn't work:
- 在Base.lproj中找到"Localizable.strings",并将其删除.它完全是空的.
- 删除了日志消息中指定的整个文件夹.
- 清理并清理构建文件夹.
- 首先运行
genstrings
以生成丢失的.strings文件.genstrings
抱怨说我的字符串不是对NSLocalizedString
的调用中的文字.嗯...它们看起来都像这样:private let ALERT_REMINDER_FIRED_TITLE = NSLocalizedString("ALERT_REMINDER_FIRED_TITLE", tableName:"ReminderHandler", comment:"my comment")
- Found "Localizable.strings" in Base.lproj and deleted it. It was completely empty.
- Deleted the whole folder specified in the log message.
- Clean and Clean build folder.
- Running
genstrings
first to generate missing .strings-files.genstrings
complained and said my strings weren't literals in the calls toNSLocalizedString
. Uhh... they all look like this:private let ALERT_REMINDER_FIRED_TITLE = NSLocalizedString("ALERT_REMINDER_FIRED_TITLE", tableName:"ReminderHandler", comment:"my comment")
我认为Localizable.strings
应该包含某种东西,例如/** no localizable strings **/
之类的东西.这样做的问题是我的项目甚至不包含文件,而是完全空了.
I figure that Localizable.strings
is supposed to contain someting, like /** no localizable strings **/
or something. The problem with that is that my project doesn't even contain the file, it's being generated as completely empty.
推荐答案
似乎未完成并注释掉对NSLocalizedString
的调用会干扰导出以进行本地化.
Seems that unfinished and commented out calls to NSLocalizedString
interfere with export for localization.
这篇关于本地化无法读取字符串文件(Xcode 6.3.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!