Changeset 673 for trunk/system/helpers/inflector.php
- Timestamp:
- 10/05/2007 03:12:01 PM (14 months ago)
- Files:
-
- 1 modified
-
trunk/system/helpers/inflector.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/helpers/inflector.php
r671 r673 3 3 class inflector { 4 4 5 protected static $uncountables = array(); 5 public static function uncountable($str) 6 { 7 static $uncountables = NULL; 8 9 if ($uncountables === NULL) 10 { 11 // Makes a mirrored array, eg: foo => foo 12 $uncountables = array_combine(Kohana::lang('inflector'), Kohana::lang('inflector')); 13 } 14 15 return isset($uncountables[$str]); 16 } 6 17 7 18 public static function singular($str) … … 9 20 $str = trim($str); 10 21 11 if (empty(self::$uncountables))12 {13 self::$uncountables = Kohana::lang('inflector');14 }15 16 22 // We can just return uncountable words 17 if ( in_array(strtolower($str), self::$uncountables))23 if (self::uncountable($str)) 18 24 return $str; 19 25 … … 43 49 $str = trim($str); 44 50 45 if (empty(self::$uncountables))46 {47 self::$uncountables = Kohana::lang('inflector');48 }49 50 51 // We can just return uncountable words 51 if ( in_array(strtolower($str), self::$uncountables))52 if (self::uncountable($str)) 52 53 return $str; 53 54
