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);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -121,6 +121,10 @@ ISTR(TEXT_SIZE);
|
||||
ISTR(SUBTRIMMODES);
|
||||
ISTR(PWR_OFF_DELAYS);
|
||||
|
||||
const char STR_MINUTE_SINGULAR[] = TR_MINUTE_SINGULAR;
|
||||
const char STR_MINUTE_PLURAL1[] = TR_MINUTE_PLURAL1;
|
||||
const char STR_MINUTE_PLURAL2[] = TR_MINUTE_PLURAL2;
|
||||
|
||||
const char STR_POPUPS_ENTER_EXIT[] = TR_POPUPS_ENTER_EXIT;
|
||||
const char STR_OK[] = TR_OK;
|
||||
const char STR_FREE[] = TR_FREE;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#ifndef _TRANSLATIONS_H_
|
||||
#define _TRANSLATIONS_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include "opentx_types.h"
|
||||
#include "translations/untranslated.h"
|
||||
|
||||
@@ -112,6 +113,16 @@
|
||||
#define LCDW_128_480_LINEBREAK "\036"
|
||||
#endif
|
||||
|
||||
constexpr int g_max_plural2 = TR_MAX_PLURAL2;
|
||||
constexpr int g_min_plural2 = TR_MIN_PLURAL2;
|
||||
constexpr int g_use_singular_in_plural = TR_USE_SINGULAR_IN_PLURAL;
|
||||
constexpr int g_use_plural2_special_case = TR_USE_PLURAL2_SPECIAL_CASE;
|
||||
constexpr int g_use_plural2 = TR_USE_PLURAL2;
|
||||
|
||||
extern const char STR_MINUTE_SINGULAR[];
|
||||
extern const char STR_MINUTE_PLURAL1[];
|
||||
extern const char STR_MINUTE_PLURAL2[];
|
||||
|
||||
extern const char* const STR_OFFON[];
|
||||
extern const char* const STR_MMMINV[];
|
||||
extern const char* const STR_VBEEPMODE[];
|
||||
|
||||
@@ -29,6 +29,18 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "分钟"
|
||||
#define TR_MINUTE_PLURAL1 "分钟"
|
||||
#define TR_MINUTE_PLURAL2 "分钟"
|
||||
|
||||
#define TR_OFFON "禁用","开启"
|
||||
#define TR_MMMINV "---","反\0"
|
||||
|
||||
@@ -31,6 +31,19 @@
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 4
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 0
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 1
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 20
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minuta"
|
||||
#define TR_MINUTE_PLURAL1 "minuty"
|
||||
#define TR_MINUTE_PLURAL2 "minut"
|
||||
|
||||
// NON ZERO TERMINATED STRINGS
|
||||
#define TR_OFFON "VYP","ZAP"
|
||||
#define TR_MMMINV "---","INV"
|
||||
|
||||
@@ -30,6 +30,19 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minut"
|
||||
#define TR_MINUTE_PLURAL1 "minutter"
|
||||
#define TR_MINUTE_PLURAL2 "minutter"
|
||||
|
||||
#define TR_OFFON "FRA","TIL"
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE "Stille","Alarm","NoKey","Alle"
|
||||
|
||||
@@ -32,6 +32,19 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minute"
|
||||
#define TR_MINUTE_PLURAL1 "minuten"
|
||||
#define TR_MINUTE_PLURAL2 "minuten"
|
||||
|
||||
// NON ZERO TERMINATED STRINGS
|
||||
#define TR_OFFON "AUS","EIN"
|
||||
#define TR_MMMINV "---","INV"
|
||||
|
||||
@@ -29,6 +29,17 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 0
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minute"
|
||||
#define TR_MINUTE_PLURAL1 "minutes"
|
||||
#define TR_MINUTE_PLURAL2 "minutes"
|
||||
|
||||
#define TR_OFFON "OFF","ON"
|
||||
#define TR_MMMINV "---","INV"
|
||||
|
||||
@@ -30,7 +30,18 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minute"
|
||||
#define TR_MINUTE_PLURAL1 "minutes"
|
||||
#define TR_MINUTE_PLURAL2 "minutes"
|
||||
|
||||
#define TR_OFFON "OFF","ON"
|
||||
#define TR_MMMINV "---","INV"
|
||||
|
||||
@@ -31,6 +31,19 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minute"
|
||||
#define TR_MINUTE_PLURAL1 "minutes"
|
||||
#define TR_MINUTE_PLURAL2 "minutes"
|
||||
|
||||
// NON ZERO TERMINATED STRINGS
|
||||
#define TR_OFFON "POI","PÄÄ"
|
||||
#define TR_MMMINV "---","KÄÄ"
|
||||
|
||||
@@ -31,6 +31,18 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minute"
|
||||
#define TR_MINUTE_PLURAL1 "minutes"
|
||||
#define TR_MINUTE_PLURAL2 "minutes"
|
||||
|
||||
// NON ZERO TERMINATED STRINGS
|
||||
#define TR_OFFON "OFF","ON"
|
||||
|
||||
@@ -32,6 +32,18 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minuto"
|
||||
#define TR_MINUTE_PLURAL1 "minuti"
|
||||
#define TR_MINUTE_PLURAL2 "minuti"
|
||||
|
||||
#define TR_OFFON TR("OFF","Disattivato"),TR("ON","Attivato")
|
||||
#define TR_MMMINV "---","INV"
|
||||
|
||||
@@ -29,6 +29,18 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minute"
|
||||
#define TR_MINUTE_PLURAL1 "minutes"
|
||||
#define TR_MINUTE_PLURAL2 "minutes"
|
||||
|
||||
#define TR_OFFON "OFF","ON"
|
||||
#define TR_MMMINV "---","リバース"
|
||||
|
||||
@@ -31,7 +31,18 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minute"
|
||||
#define TR_MINUTE_PLURAL1 "minutes"
|
||||
#define TR_MINUTE_PLURAL2 "minutes"
|
||||
|
||||
#define TR_OFFON "UIT","AAN"
|
||||
#define TR_MMMINV "---","INV"
|
||||
|
||||
@@ -31,6 +31,18 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 4
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 0
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 1
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minuta"
|
||||
#define TR_MINUTE_PLURAL1 "minuty"
|
||||
#define TR_MINUTE_PLURAL2 "minut"
|
||||
|
||||
#define TR_OFFON "WYŁ","ZAŁ"
|
||||
#define TR_MMMINV "---","REV"
|
||||
|
||||
@@ -31,6 +31,19 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minute"
|
||||
#define TR_MINUTE_PLURAL1 "minutes"
|
||||
#define TR_MINUTE_PLURAL2 "minutes"
|
||||
|
||||
#define TR_OFFON "OFF","ON"
|
||||
#define TR_MMMINV "---","INV"
|
||||
#define TR_VBEEPMODE "Mudo","Alarm","NoKey","Todo"
|
||||
|
||||
@@ -32,6 +32,19 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "minut"
|
||||
#define TR_MINUTE_PLURAL1 "minuter"
|
||||
#define TR_MINUTE_PLURAL2 "minuter"
|
||||
|
||||
// NON ZERO TERMINATED STRINGS
|
||||
#define TR_OFFON "Av","På"
|
||||
#define TR_MMMINV "---","INV"
|
||||
|
||||
@@ -29,6 +29,18 @@
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
#define TR_MIN_PLURAL2 2
|
||||
#define TR_MAX_PLURAL2 2
|
||||
// For this number of minute in the last decimal place singular form is used in
|
||||
// plural
|
||||
#define TR_USE_SINGULAR_IN_PLURAL 1
|
||||
#define TR_USE_PLURAL2_SPECIAL_CASE 0
|
||||
// If the number of minutes is above this value PLURAL2 is used
|
||||
#define TR_USE_PLURAL2 INT_MAX
|
||||
|
||||
#define TR_MINUTE_SINGULAR "分鐘"
|
||||
#define TR_MINUTE_PLURAL1 "分鐘"
|
||||
#define TR_MINUTE_PLURAL2 "分鐘"
|
||||
|
||||
#define TR_OFFON "禁用","開啟"
|
||||
#define TR_MMMINV "---","反"
|
||||
|
||||
Reference in New Issue
Block a user