Localised concatenation of strings

Number:rdar://37880652 Date Originated:6/2/2018
Status:Duplicate/12306012/Open Resolved:
Product:Foundation Product Version:
Classification:Suggestion Reproducible:
I'd like to generate localised string from the following code:
let skills = ["nunchuck", "bow hunting", "computer hacking"]
let notLocalizedJoined = skills.joined(separator: ", ")

Looking at the wikipedia article for "comma", not only is there different kinds of separators, but the elements are ordered differently or some languages mightn't have a separator at all.

And this is to say nothing about generating a list where optionally, say in English, the word "and" could precede the final element:
"nunchuck, bow hunting and computer hacking"

Turns out there's an `icu::ListFormatter` class in the ICU libraries, maybe it's time for an `NSListFormatter`?

I would have loved to submit a pull request implementing this in the Swift Foundation project but I quickly realised CoreFoundation should be consistent and offer the same functionality upon which the Swift Foundation project should bridge. If only CoreFoundation was open source *hint*!



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!