I used a NSLocalizedStringcustom function.
For example, to access Profile.stringsI define this function:
func LocalizedProfile(key: String, comment: String?) {
NSLocalizedString(key, tableName: "Profile", comment: comment ?? "")
}
And, it is called like this:
let localized = LocalizedProfile("Submit", comment: "For registration")
This method works fine except for exporting XLIFF.
In Xcode 6.3.2, execution Export for localizationcauses an error:

To get information about the error, I ran through the command line:
xcodebuild -exportLocalizations -localizationPath ./xliff -project MyApp.xcodeproj -exportLanguage ja
And I got this error:
Bad entry in file /Users/mono/Documents/Git/MyApp/Localization.swift (line = 29): Argument is not a literal string.
Defining a custom localization method is very useful for me, but I also want to use the XLIFF export function.
Are there any methods to address these requirements?
source
share