kevinlawler / NSDate-TimeAgo

A "time ago", "time since", "relative date", or "fuzzy date" category for NSDate and iOS, Objective-C, Cocoa Touch, iPhone, iPad
ISC License
1.75k stars 322 forks source link

Pluralization dont work because wrong RU locale code #93

Open wiistriker opened 8 years ago

wiistriker commented 8 years ago

https://github.com/kevinlawler/NSDate-TimeAgo/blob/master/NSDate%2BTimeAgo.m#L366 but locale code is "ru-RU"

What is a good way to check locale? Starts with "ru" or simple:

if([localeCode isEqual:@"ru"] || [localeCode isEqualToString:@"ru-RU"]) {

?

mixdesign commented 8 years ago

I think you are right. SO answer has interesting comment related to this issue: http://stackoverflow.com/questions/3910244/getting-current-device-language-in-ios#comment19209319_4221416

Comment advices to do:

 NSString * localeCode = [[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2]