1

对使用参数的每次调用都使用命令行时出现Bad entry in file错误genstringsNSLocalizedStringtableName

尝试生成本地化字符串时请参阅以下示例(来自Firefox-iOS

find . -name *.swift | xargs genstrings -o en.lproj

文件 ./StorageTests/TestSQLiteHistory.swift 中的错误条目(行 = 100):参数不是文字字符串。

文件 ./StorageTests/TestSQLiteHistory.swift 中的错误条目(行 = 101):参数不是文字字符串。

文件 ./StorageTests/TestSQLiteHistory.swift 中的错误条目(行 = 102):参数不是文字字符串。

文件 ./StorageTests/TestSQLiteHistory.swift 中的错误条目(行 = 103):参数不是文字字符串。参数不是文字字符串。

这是这些行的代码

let titleMobile = NSLocalizedString("Mobile Bookmarks", tableName: "Storage", comment: "The title of the folder that contains mobile bookmarks. This should match bookmarks.folder.mobile.label on Android.")
let titleMenu = NSLocalizedString("Bookmarks Menu", tableName: "Storage", comment: "The name of the folder that contains desktop bookmarks in the menu. This should match bookmarks.folder.menu.label on Android.")
let titleToolbar = NSLocalizedString("Bookmarks Toolbar", tableName: "Storage", comment: "The name of the folder that contains desktop bookmarks in the toolbar. This should match bookmarks.folder.toolbar.label on Android.")
let titleUnsorted = NSLocalizedString("Unsorted Bookmarks", tableName: "Storage", comment: "The name of the folder that contains unsorted desktop bookmarks. This should match bookmarks.folder.unfiled.label on Android.")

当我搜索解决方案时,我发现了这个用于生成和合并本地化字符串的工具。它适用于这种情况,生成本地化字符串并将其合并到Localizable.strings,但在运行时应用程序不显示本地化标题,因为它尝试从名称Storage.strings不是来自的文件中加载本地化字符串Localizable.strings

是否有任何解决方案可以自动生成这些文件而不是手动生成?

4

1 回答 1

0

看来我需要根据苹果的最新程序翻译资源

  1. 使用 Xcode导出本地化文件.xliff(在 Xcode 中选择您的项目,然后选择 Editor -> Export for Localization)
  2. 使用翻译工具翻译所有键(SwordFishbrightec 在线 xliff 编辑器
  3. 将翻译后的文件重新导入 Xcode

参考: https ://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html

于 2015-12-11T10:50:38.840 回答