christian Muller
christian Muller

Reputation: 5056

cocoa accept international numbers

I have a calendar and can make local month names and short weekday names, for example weekdaynames with:

NSArray *weekdayNames = [[[[NSDateFormatter alloc] init] autorelease] shortWeekdaySymbols];

How can I localize these?

For example:

a daycounter i = 1..31

daystr = [NSString stringWithFormat: @" %i", daycounter];}

I get fine 1...31 in latin Numbers

What do I have to change/add that I get for example Arabic Numbers, Chinese Numbers etc?

Upvotes: 0

Views: 174

Answers (2)

christian Muller
christian Muller

Reputation: 5056

I solved it now with:

NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    daystr = [formatter stringFromNumber:[NSNumber numberWithInt:daycounter]];
    [formatter release];

Upvotes: 1

mcandre
mcandre

Reputation: 24602

You could remove the restrictions altogether.

daystr = [NSString stringWithString: @" %s", daycounter];}

Upvotes: 0

Related Questions