Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor code formatting

  • Loading branch information...
commit 16ac60c45dc06c44ede5933b349f47bc70ba91f4 1 parent 8de57be
@mattt authored
Showing with 26 additions and 28 deletions.
  1. +26 −28 TTTLocalizedPluralString.m
View
54 TTTLocalizedPluralString.m
@@ -123,43 +123,41 @@
}
}
-static NSString * TTTSpanishPluralRuleForCount(NSUInteger count) {
- switch (count) {
- case 1:
- return kTTTOnePluralRule;
- default:
- return kTTTOtherPluralRule;
- }
-}
-
-static NSString * TTTThaiPluralRuleForCount(NSUInteger count) {
- return kTTTOtherPluralRule;
-}
-
static NSString * TTTRussianPluralRuleForCount(NSUInteger count) {
-
- NSUInteger n10 = count % 10;
- NSUInteger n100 = count % 100;
-
- switch (n10)
- {
+ NSUInteger mod10 = count % 10;
+ NSUInteger mod100 = count % 100;
+
+ switch (mod10) {
case 1:
- if (n100 != 11)
- return kTTTOnePluralRule;
+ if (mod100 != 11) {
+ return kTTTOnePluralRule;
+ }
break;
-
case 2:
case 3:
case 4:
- if (n100 != 12 && n100 != 13 && n100 != 14)
+ if (mod100 != 12 && mod100 != 13 && mod100 != 14) {
return kTTTFewPluralRule;
+ }
break;
-
- default:
+ default:
break;
}
- return kTTTManyPluralRule;
+ return kTTTManyPluralRule;
+}
+
+static NSString * TTTSpanishPluralRuleForCount(NSUInteger count) {
+ switch (count) {
+ case 1:
+ return kTTTOnePluralRule;
+ default:
+ return kTTTOtherPluralRule;
+ }
+}
+
+static NSString * TTTThaiPluralRuleForCount(NSUInteger count) {
+ return kTTTOtherPluralRule;
}
NSString * TTTLocalizedPluralStringKeyForCountAndSingularNoun(NSUInteger count, NSString *singular) {
@@ -186,12 +184,12 @@
pluralRule = TTTKoreanPluralRuleForCount(count);
} else if ([languageCode isEqualToString:@"pt"]) {
pluralRule = TTTPortuguesePluralRuleForCount(count);
+ } else if ([languageCode isEqualToString:@"ru"]) {
+ pluralRule = TTTRussianPluralRuleForCount(count);
} else if ([languageCode isEqualToString:@"es"]) {
pluralRule = TTTSpanishPluralRuleForCount(count);
} else if ([languageCode isEqualToString:@"th"]) {
pluralRule = TTTThaiPluralRuleForCount(count);
- } else if ([languageCode isEqualToString:@"ru"]) {
- pluralRule = TTTRussianPluralRuleForCount(count);
} else {
NSLog(@"Unsupported language: %@", languageCode);
return nil;
Please sign in to comment.
Something went wrong with that request. Please try again.