In Swift files, genstrings Chokes On NSLocalizedString calls with more than two parameters

Originator:wesgilpin
Number:rdar://22133811 Date Originated:8/4/2015
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:
 
Summary:
When running genstrings against a Swift file, if there are any NSLocalizedString calls that use more than the trivial case of "value" and "comment" parameters, genstrings errors out. Specifically, I need to use a three-parameter form by adding the "key" parameter.

Steps to Reproduce:
In a Swift file, create an NSLocalizedString call with more than two parameters:

18: let someOtherString = NSLocalizedString("Some Other String", comment: "Some Other String")
19: print(someOtherString)
20: let theString = NSLocalizedString("Some String", value: "Some Value", comment: "Some Comment")
21: print(theString)

Expected Results:
I expect genstrings to output a Localizable.strings file instead of giving an error.

Actual Results:
genstrings spits out this error. It's fine with calls using two parameters (value and comment, line 18 in the Steps to Reproduce), but adding the "key" parameter (line 20) causes this error:

❯ /Applications/Xcode-beta.app/Contents/Developer/usr/bin/genstrings *.swift
Bad entry in file AppDelegate.swift (line = 20): Argument is not a literal string.

Version:
Xcode 6.4 and Xcode 7, beta 4.

Notes:


Configuration:
Xcode 6.4 and / or Xcode 7 beta installed on a MacBook Pro

Comments

Still broken in Xcode 8.2.1

Have there been any updates from Apple at all on this?

By oliver.foggin at March 20, 2017, 11:26 a.m. (reply...)

Confirmed still a problem in Xcode 7.0.0 Release from the App Store


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!