forked from eatvio/eatvio_app
updated designe of aboute diet page
This commit is contained in:
43
lib/core/utils/localization_utils.dart
Normal file
43
lib/core/utils/localization_utils.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
|
||||
String getLocalizedMeasurementUnits(S s, Portion portion) {
|
||||
switch (portion) {
|
||||
case Portion.GRAMS:
|
||||
return s.gr;
|
||||
case Portion.MILLILITERS:
|
||||
return s.milliliter;
|
||||
case Portion.PCS:
|
||||
return s.pcs;
|
||||
}
|
||||
}
|
||||
|
||||
String getDayForm(int number, S s) {
|
||||
if (number % 100 >= 11 && number % 100 <= 14) {
|
||||
return s.days;
|
||||
}
|
||||
|
||||
int lastDigit = number % 10;
|
||||
if (lastDigit == 1) {
|
||||
return s.day.toLowerCase();
|
||||
} else if (lastDigit >= 2 && lastDigit <= 4) {
|
||||
return s.another_form_of_day;
|
||||
} else {
|
||||
return s.days;
|
||||
}
|
||||
}
|
||||
|
||||
String getCommentForm(int number, S s) {
|
||||
if (number % 100 >= 11 && number % 100 <= 14) {
|
||||
return s.comments_plural;
|
||||
}
|
||||
|
||||
int lastDigit = number % 10;
|
||||
if (lastDigit == 1) {
|
||||
return s.comment;
|
||||
} else if (lastDigit >= 2 && lastDigit <= 4) {
|
||||
return s.another_form_of_comment;
|
||||
} else {
|
||||
return s.comments_plural;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user