Last active
August 29, 2015 13:55
-
-
Save olexth/8729980 to your computer and use it in GitHub Desktop.
Declension for words in russian language depending on count between current word. More about declension: http://en.wikipedia.org/wiki/Russian_grammar#Declension_of_numerals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *)stringFromCount:(NSUInteger)count | |
{ | |
NSString *days = nil; | |
NSUInteger modulo10 = count % 10; | |
if (modulo10 == 1) | |
{ | |
days = NSLocalizedString(@"день", nil); | |
} | |
if (modulo10 == 2 || modulo10 == 3 || modulo10 == 4) | |
{ | |
days = NSLocalizedString(@"дня", nil); | |
} | |
if (modulo10 >= 5 || modulo10 == 0 || (count >= 11 && count <= 14)) | |
{ | |
days = NSLocalizedString(@"дней", nil); | |
} | |
return [NSString stringWithFormat:@"%i %@", count, days]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment