Smartling / ios-i18n

The ios-i18n library provides seamless integration of plurals into iOS 6 apps.
http://www.smartling.com
Apache License 2.0
205 stars 41 forks source link

Improvement: add macro the get rid of using stringWithFormat: #16

Closed albertschulz closed 9 years ago

albertschulz commented 9 years ago

I'd be really nice if there'd be a call like (as seen at mattts framework https://github.com/mattt/TTTLocalizedPluralString):

NSString *text = SLPluralizedString(@"%d apples", number, @"Comment");

instead of

int number = 42;
NSString *format = SLPluralizedString(@"%d apples", number, @"Comment");
NSString *text = [NSString stringWithFormat:format, number];
HeEAaD commented 9 years ago

+1

jawalk4u commented 9 years ago

image

paiv commented 9 years ago

@albertschulz, as in the mattt's, a macro could be a simple one like

#define MyPluralizedStringFormat(key, n) \
    [NSString stringWithFormat:SLPluralizedString(key, n, nil), n]

My point why it is not in the library:

paiv commented 9 years ago

@jawalk4u is it related to the question?