<div dir="ltr">Hi,<div><br></div><div>I've been having an issue with a localised string,, one of which has a percentage sign in it:</div><div><span class="gmail-s1" style="color:rgb(255,91,83);font-family:menlo;font-size:11px"><br></span></div><div><span class="gmail-s1" style="color:rgb(255,91,83);font-family:menlo;font-size:11px">"GAMERANK_5_DESC"</span><span class="gmail-s2" style="font-family:menlo;font-size:11px"> = </span><span class="gmail-s1" style="color:rgb(255,91,83);font-family:menlo;font-size:11px">"Wow! You're racing ahead. Only 5%% of our users get here!"</span><span class="gmail-s2" style="font-family:menlo;font-size:11px">;</span></div>
<div><div><br></div><div>the key is built as such:</div><div><br></div><div>Obj-c : <font face="monospace, monospace">NSString *key = <span class="gmail-s1">[</span><span class="gmail-s2">NSString</span><span class="gmail-s1"> </span><span class="gmail-s3">stringWithFormat</span><span class="gmail-s1">:</span><span class="gmail-s4" style="color:rgb(255,91,83)">@"GAMERANK_%@_DESC"</span><span class="gmail-s1">,rank];</span></font></div>
<div><br></div><div>Swift: <font face="monospace, monospace">let key = <span class="gmail-s2">"GAMERANK_\(</span>rank)_DESC"</font></div><div><br></div><div>Then localised with the same macro: <span class="gmail-s1" style="color:rgb(189,153,255);font-family:menlo;font-size:11px">NSLocalizedString</span><span class="gmail-s2" style="font-family:menlo;font-size:11px">(key, </span><span class="gmail-s3" style="font-family:menlo;font-size:11px">@""</span><span class="gmail-s2" style="font-family:menlo;font-size:11px">);</span></div>
<div><br></div><div>The output is different though:</div><div><br></div><div>Obj- C = <span style="color:rgb(255,91,83);font-family:menlo;font-size:11px">"Wow! You're racing ahead. Only 5% of our users get here!"</span></div><div>Swift = <span style="color:rgb(255,91,83);font-family:menlo;font-size:11px">"Wow! You're racing ahead. Only 5%% of our users get here!"</span></div><div><br></div><div>Is this a bug in the swifts localisation parsing? Does the percentage sign not need to be escaped in Swift?</div><div><br></div><div>Cheers</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><font face="HelveticaNeue-Light"><br>–</font></div><div><font face="HelveticaNeue-Medium">ADAM SUTCLIFFE</font></div><div><font face="HelveticaNeue-Light">Software Engineer</font></div><div><font face="Helvetica Neue"><br></font></div><div><font face="HelveticaNeue-Light">–</font></div><div><font face="HelveticaNeue-Light"><a value="+447000000000" style="color:rgb(17,85,204)">+44 (0)7786 692 639</a></font></div><div><font face="HelveticaNeue-Light"><a href="mailto:name@peak.net" style="color:rgb(17,85,204)" target="_blank">adam@peak.net</a></font></div><div><font face="HelveticaNeue-Light"><a href="http://peak.net/" style="color:rgb(17,85,204)" target="_blank">peak.net</a></font></div></div></div>
</div></div>