Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
ok... so i have a string that displays a floating point number with 2 decimal places. by default, float displays with a period. however, my app is localized into french (english dev base), and in québec and france, numbers are displayed with a comma, not a period.

Code:
self.myNumberString = [NSString stringWithFormat:@"%.2f", aFloat];

how do i display this string float with a comma IF it is currently being viewed in french localization?
 
humm... localizedStringWithFormat doesn't seem to be working for me, although after reading about it on the docs, it's exactly what i'm looking for. here's my code:

Code:
self.lightSizeString = [NSString localizedStringWithFormat:@"%.2f x %.2f %@", ((dragFrame.origin.x + kDragViewWidthHeight - centerPoint.x) * 2) / 163, ((dragFrame.origin.y + kDragViewWidthHeight - centerPoint.y) * 2) / 163, self.lightSizeUnit];

the resulting string in french environment still displays the dot instead of the comma.
 
i've attached a tiny sample project. switching the simulator (or device) into French results in the string's float still being displayed with a dot.

any ideas?
 

Attachments

  • LocalizedStringWithFormat.zip
    20 KB · Views: 162
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.