addIrregularInflectionRule method
void
addIrregularInflectionRule(
- String singular,
- String plural
)
Implementation
void addIrregularInflectionRule(String singular, String plural) {
final s0 = singular.substring(0, 1);
final srest = singular.substring(1);
final p0 = plural.substring(0, 1);
final prest = plural.substring(1);
if (s0.toUpperCase() == p0.toUpperCase()) {
addInflectionRule('(${s0})${srest}\$', (Match m) => '${m[1]}${srest}');
addInflectionRule('(${p0})${prest}\$', (Match m) => '${m[1]}${srest}');
} else {
addInflectionRule('${s0.toUpperCase()}(?i)${srest}\$',
(Match m) => '${s0.toUpperCase()}${srest}');
addInflectionRule('${s0.toLowerCase()}(?i)${srest}\$',
(Match m) => '${s0.toUpperCase()}${srest}');
addInflectionRule('${p0.toUpperCase()}(?i)${prest}\$',
(Match m) => '${s0.toUpperCase()}${srest}');
addInflectionRule('${p0.toLowerCase()}(?i)${prest}\$',
(Match m) => '${s0.toLowerCase()}${srest}');
}
}