[swift-evolution] Localization support for string interpolation

Uli Kusterer kusterer at orangejuiceliberationfront.com
Thu Apr 21 05:41:00 CDT 2016


 Daniel, thanks for posting this. As you already know from Twitter, I'm very much in favor of this proposal. I can pretty much not use string interpolation because it doesn't localize properly.

On 21 Apr 2016, at 09:42, Daniel Höpfl via swift-evolution <swift-evolution at swift.org> wrote:
> So, `NSLocalizedString` (and friends) would “just work” with string
> interpolation. I’m not sure about the key format to use but my proof of
> concept simply replaces every interpolation with `%@` which seems
> reasonable.

 One request: Could you perhaps use positional syntax? In some languages, the word order of the placeholders needs to change, and there needs to be a way to detect that the translator swapped two placeholders. In NSLocalizedString, that is done via %1$@, %2$@.

— Uli Kusterer
“The Witnesses of TeachText are everywhere..."



More information about the swift-evolution mailing list