Reputation: 124
I have a string which hold a varying part in the middle according to some cases.
Example: You lost 255 points.
The point value "255" is the varying part and I want to hold the non-varying part in my string file. However I don't want to have two entries in my strings file like.
"string_start" = "You lost" "string_end" = "points."
Btw the points part which is (255) in the example is an NSMutableAttributedString to support a different color and font style.
Thanks in Advance.
Upvotes: 0
Views: 53
Reputation: 315
I would do it like this:
[NSString stringWithFormat:NSLocalizedString(@"You lost %d points", nil), 255]
and you localize @"You lost %d points"
in whatever language you want.
Upvotes: 1