Initial and done prolly
This commit is contained in:
commit
6f88b9966f
175 changed files with 15445 additions and 0 deletions
24
lib/utils/pluralize_int_extension.dart
Normal file
24
lib/utils/pluralize_int_extension.dart
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extension PluralizeIntExtension on int {
|
||||
String pluralize({
|
||||
required String name,
|
||||
required String absent,
|
||||
required String absentMul,
|
||||
}) {
|
||||
final plurality = this % 10 == 1 && this % 100 != 11
|
||||
? 0
|
||||
: this % 10 >= 2 &&
|
||||
this % 10 <= 4 &&
|
||||
(this % 100 < 10 || this % 100 >= 20)
|
||||
? 1
|
||||
: 2;
|
||||
|
||||
switch (plurality) {
|
||||
case 1:
|
||||
return "$this $absent";
|
||||
case 2:
|
||||
return "$this $absentMul";
|
||||
default:
|
||||
return "$this $name";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue