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]}${prest}');
addInflectionRule('(${p0})${prest}\$', (Match m) => '${m[1]}${prest}');
} else {
addInflectionRule('${s0.toUpperCase()}(?i)${srest}\$', (Match m) => '${p0.toUpperCase()}${prest}');
addInflectionRule('${s0.toLowerCase()}(?i)${srest}\$', (Match m) => '${p0.toUpperCase()}${prest}');
addInflectionRule('${p0.toUpperCase()}(?i)${prest}\$', (Match m) => '${p0.toUpperCase()}${prest}');
addInflectionRule('${p0.toLowerCase()}(?i)${prest}\$', (Match m) => '${p0.toLowerCase()}${prest}');
}
}