2017-05-04 77 views
1

當我嘗試導出我的文件進行翻譯我得到這個日誌:出口本地化錯誤

[MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-12169/IDEFoundation/Localization/IDELocalizationWork.m:355 Details: Failed to read strings file "/var/folders/ny/054nwfjs63v3v9rlpkfbt94w0000gn/T/Xcode3SourceStringsAdaptor-EAAAA7F1-000C-432D-BB22-49394ECF78A9/Localizable.strings", underlying error: The data couldn’t be read because it isn’t in the correct format. Object: Method: -work Thread: {number = 1, name = main} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

我檢查這個文件,它不屬於我的文件,它是空的。爲什麼Xcode試圖去本地化這個文件,而不是我的項目Localizable.strings?每次我嘗試導出時,Xcode都會在新的臨時文件夾中創建新的空文件。

我使用String擴展,它是將localized計算VAR像here

回答

1

原來,在你的應用程序的代碼NSLocalizedString調用導出工具掃描。使用String擴展名時,它無法成功解析源文件。

NSLocalizedString("text_id", comment: "")替換所有"text_id".localized電話後,出口正常工作。

希望它會幫助別人。