billymeltdown / nsdate-helper

A category to extend Cocoa's NSDate class with some convenience functions.
http://www.zetetic.net/blog/
457 stars 107 forks source link

Support for Locale? #19

Open chrux opened 10 years ago

chrux commented 10 years ago

Is there any plan to support more language, like spanish?

billymeltdown commented 9 years ago

Hi @chrux I'm sorry I didn't write back to your request sooner, I must have missed it. NSLocalizedString() is being used for a couple of the few raw strings in this category, there's also some prefixes in there that need to be adjusted, specifically:

https://github.com/billymeltdown/nsdate-helper/blob/master/NSDate%2BHelper.m#L114 https://github.com/billymeltdown/nsdate-helper/blob/master/NSDate%2BHelper.m#L230

Otherwise, you should be able to use this category with a translation now, the two strings localized being "Yesterday" and "Today." Dates are otherwise formatted based on the user's currentCalendar, which takes locale into account.

chrux commented 9 years ago

Yeah, you're right, just one improvement to this line

text = [NSString stringWithFormat:@"%ld days ago", (NSInteger)daysAgo];

Maybe "days ago" should use "NSLocalizedString" too