[swift-users] Swift localisation, percentage sign escaping
fs.output at gmail.com
Thu May 11 13:23:53 CDT 2017
2017-05-11 18:44 GMT+09:00 Adam Sutcliffe via swift-users <
swift-users at swift.org>:
> I've been having an issue with a localised string,, one of which has a
> percentage sign in it:
> "GAMERANK_5_DESC" = "Wow! You're racing ahead. Only 5%% of our users get
> the key is built as such:
> Obj-c : NSString *key = [NSString stringWithFormat:@"GAMERANK_%@_DESC"
> Swift: let key = "GAMERANK_\(rank)_DESC"
> Then localised with the same macro: NSLocalizedString(key, @"");
> The output is different though:
> Obj- C = "Wow! You're racing ahead. Only 5% of our users get here!"
> Swift = "Wow! You're racing ahead. Only 5%% of our users get here!"
How do you check the output?
If you are using NSLog(output) in Obj-C and print(output) in Swift, that is
The first parameter of NSLog is a format.
> Is this a bug in the swifts localisation parsing? Does the percentage sign
> not need to be escaped in Swift?
> ADAM SUTCLIFFE
> Software Engineer
> +44 (0)7786 692 639
> adam at peak.net <name at peak.net>
> swift-users mailing list
> swift-users at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users