In swift to create a localized string use `NSLocalizedString(key: , value: , comment:)
But in the older objective C https://developer.apple.com/documentation/foundation/nslocalizedstring
There only appears to be key and comment and key appears to act as both the key and the value in the xliff file.
My question is how do I give a key and value to a nslocalizedstring in objective C?
2
Answers
You’re looking at a reduced form of the macro. The full form is called saying
See https://developer.apple.com/documentation/foundation/nslocalizedstringwithdefaultvalue
Just set the stuff you don’t care about at nil.
matt has the correct answer; however, to spell it out directly:
In Swift:
In Objective C:
The Objective C version lets you look under the hood to see how it’s done. Here is the code for the
NSLocalizedString*
macros in NSBundle.h.