示例#1
0
Inflections::singular('/(bus)es$/i', '\\1');
Inflections::singular('/(o)es$/i', '\\1');
Inflections::singular('/(shoe)s$/i', '\\1');
Inflections::singular('/(cris|ax|test)es$/i', '\\1is');
Inflections::singular('/([octop|vir])i$/i', '\\1us');
Inflections::singular('/(alias|status)es$/i', '\\1');
Inflections::singular('/^(ox)en/i', '\\1');
Inflections::singular('/(vert|ind)ices$/i', '\\1ex');
Inflections::singular('/(matr)ices$/i', '\\1ix');
Inflections::singular('/(quiz)zes$/i', '\\1');
Inflections::irregular('person', 'people');
Inflections::irregular('man', 'men');
Inflections::irregular('child', 'children');
Inflections::irregular('sex', 'sexes');
Inflections::irregular('move', 'moves');
Inflections::irregular('cow', 'kine');
Inflections::uncountable('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
# End Default Inflections
/**
 *  Implement the Trax naming convention
 *
 *  Inflections is never instantiated.
 */
class Inflections
{
    public static $plurals = array(), $singulars = array(), $uncountables = array(), $humans = array();
    # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression.
    # The replacement should always be a string that may include references to the matched data from the rule.
    function plural($rule, $replacement)
    {
        array_unshift(self::$plurals, array("rule" => $rule, "replacement" => $replacement));
示例#2
0
Inflections::singular('/([m|l])ice$/i', '\\1ouse');
Inflections::singular('/(bus)es$/i', '\\1');
Inflections::singular('/(o)es$/i', '\\1');
Inflections::singular('/(shoe)s$/i', '\\1');
Inflections::singular('/(cris|ax|test)es$/i', '\\1is');
Inflections::singular('/([octop|vir])i$/i', '\\1us');
Inflections::singular('/(alias|status)es$/i', '\\1');
Inflections::singular('/^(ox)en/i', '\\1');
Inflections::singular('/(vert|ind)ices$/i', '\\1ex');
Inflections::singular('/(matr)ices$/i', '\\1ix');
Inflections::singular('/(quiz)zes$/i', '\\1');
Inflections::irregular('person', 'people');
Inflections::irregular('man', 'men');
Inflections::irregular('child', 'children');
Inflections::irregular('sex', 'sexes');
Inflections::irregular('move', 'moves');
Inflections::uncountable('equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep');
# End Default Inflections
/**
 *  Implement the Trax naming convention
 *
 *  Inflections is never instantiated.
 */
class Inflections
{
    public static $plurals = array();
    public static $singulars = array();
    public static $uncountables = array();
    # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression.
    # The replacement should always be a string that may include references to the matched data from the rule.
    function plural($rule, $replacement)