fix(color): Inactivity alarm suffix proper grammar (singular/plural) (#3064)
* Add translations for "minutes" * Add missing PLURAL2 * fix grammar * Next attempt * include limits.h * minor cleanup * Addin some translations for some languages based on inputs * chore: Remove BREAKSPACE, add ignore flag And some minor cleanup / formatting * chore: Revert `TR_USE_VARIABLE_PLURAL` Use `TR_USE_SINGULAR_IN_PLURAL` properly... thanks @eshifri Co-authored-by: eshifri <eshifri@hotmail.com>
This commit is contained in:
@@ -434,18 +434,43 @@ class AlarmsPage : public Page {
|
||||
new StaticText(line, rect_t{}, STR_INACTIVITYALARM, 0, COLOR_THEME_PRIMARY1);
|
||||
edit = new NumberEdit(line, rect_t{}, 0, 250, GET_SET_DEFAULT(g_eeGeneral.inactivityTimer));
|
||||
lv_obj_set_style_grid_cell_x_align(edit->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
||||
edit->setSuffix("minutes");
|
||||
|
||||
edit->setDisplayHandler([=](int value) -> std::string {
|
||||
std::string suffix(STR_MINUTE_PLURAL2);
|
||||
if (value == 1) {
|
||||
suffix = std::string(STR_MINUTE_SINGULAR);
|
||||
} else if (value < g_use_plural2) {
|
||||
const int secondDecimal = (value / 10) % 10;
|
||||
if (secondDecimal != 1) {
|
||||
const int firstDecimal = value % 10;
|
||||
if (firstDecimal) {
|
||||
if (firstDecimal < g_min_plural2 &&
|
||||
firstDecimal == g_use_singular_in_plural) {
|
||||
suffix = std::string(STR_MINUTE_SINGULAR);
|
||||
} else if (firstDecimal <= g_max_plural2 &&
|
||||
firstDecimal != g_use_plural2_special_case) {
|
||||
suffix = std::string(STR_MINUTE_PLURAL1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
suffix = " " + suffix;
|
||||
return formatNumberAsString(value, 0, 0, nullptr, suffix.c_str());
|
||||
});
|
||||
line = body.newLine(&grid);
|
||||
|
||||
// Alarms warning
|
||||
new StaticText(line, rect_t{}, STR_ALARMWARNING, 0, COLOR_THEME_PRIMARY1);
|
||||
new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.disableAlarmWarning));
|
||||
new CheckBox(line, rect_t{},
|
||||
GET_SET_INVERTED(g_eeGeneral.disableAlarmWarning));
|
||||
line = body.newLine(&grid);
|
||||
|
||||
// RSSI shutdown alarm
|
||||
new StaticText(line, rect_t{}, STR_RSSI_SHUTDOWN_ALARM, 0, COLOR_THEME_PRIMARY1);
|
||||
new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.disableRssiPoweroffAlarm));
|
||||
new StaticText(line, rect_t{}, STR_RSSI_SHUTDOWN_ALARM, 0,
|
||||
COLOR_THEME_PRIMARY1);
|
||||
new CheckBox(line, rect_t{},
|
||||
GET_SET_INVERTED(g_eeGeneral.disableRssiPoweroffAlarm));
|
||||
line = body.newLine(&grid);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user