mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 00:05:22 +03:00
i18n final statistics from OSD
This commit is contained in:
parent
7f452d9c96
commit
2d5263996c
2 changed files with 130 additions and 5 deletions
|
@ -1111,102 +1111,127 @@ OSD.constants = {
|
|||
ALL_STATISTIC_FIELDS: {
|
||||
MAX_SPEED: {
|
||||
name: 'MAX_SPEED',
|
||||
text: 'osdTextStatMaxSpeed',
|
||||
desc: 'osdDescStatMaxSpeed'
|
||||
},
|
||||
MIN_BATTERY: {
|
||||
name: 'MIN_BATTERY',
|
||||
text: 'osdTextStatMinBattery',
|
||||
desc: 'osdDescStatMinBattery'
|
||||
},
|
||||
MIN_RSSI: {
|
||||
name: 'MIN_RSSI',
|
||||
text: 'osdTextStatMinRssi',
|
||||
desc: 'osdDescStatMinRssi'
|
||||
},
|
||||
MAX_CURRENT: {
|
||||
name: 'MAX_CURRENT',
|
||||
text: 'osdTextStatMaxCurrent',
|
||||
desc: 'osdDescStatMaxCurrent'
|
||||
},
|
||||
USED_MAH: {
|
||||
name: 'USED_MAH',
|
||||
text: 'osdTextStatUsedMah',
|
||||
desc: 'osdDescStatUsedMah'
|
||||
},
|
||||
MAX_ALTITUDE: {
|
||||
name: 'MAX_ALTITUDE',
|
||||
text: 'osdTextStatMaxAltitude',
|
||||
desc: 'osdDescStatMaxAltitude'
|
||||
},
|
||||
BLACKBOX: {
|
||||
name: 'BLACKBOX',
|
||||
text: 'osdTextStatBlackbox',
|
||||
desc: 'osdDescStatBlackbox'
|
||||
},
|
||||
END_BATTERY: {
|
||||
name: 'END_BATTERY',
|
||||
text: 'osdTextStatEndBattery',
|
||||
desc: 'osdDescStatEndBattery'
|
||||
},
|
||||
FLYTIME: {
|
||||
name: 'FLY_TIME',
|
||||
text: 'osdTextStatFlyTime',
|
||||
desc: 'osdDescStatFlyTime'
|
||||
},
|
||||
ARMEDTIME: {
|
||||
name: 'ARMED_TIME',
|
||||
text: 'osdTextStatArmedTime',
|
||||
desc: 'osdDescStatArmedTime'
|
||||
},
|
||||
MAX_DISTANCE: {
|
||||
name: 'MAX_DISTANCE',
|
||||
text: 'osdTextStatMaxDistance',
|
||||
desc: 'osdDescStatMaxDistance'
|
||||
},
|
||||
BLACKBOX_LOG_NUMBER: {
|
||||
name: 'BLACKBOX_LOG_NUMBER',
|
||||
text: 'osdTextStatBlackboxLogNumber',
|
||||
desc: 'osdDescStatBlackboxLogNumber'
|
||||
},
|
||||
TIMER_1: {
|
||||
name: 'TIMER_1',
|
||||
text: 'osdTextStatTimer1',
|
||||
desc: 'osdDescStatTimer1'
|
||||
},
|
||||
TIMER_2: {
|
||||
name: 'TIMER_2',
|
||||
text: 'osdTextStatTimer2',
|
||||
desc: 'osdDescStatTimer2'
|
||||
},
|
||||
RTC_DATE_TIME: {
|
||||
name: 'RTC_DATE_TIME',
|
||||
text: 'osdTextStatRtcDateTime',
|
||||
desc: 'osdDescStatRtcDateTime'
|
||||
},
|
||||
STAT_BATTERY: {
|
||||
name: 'BATTERY_VOLTAGE',
|
||||
text: 'osdTextStatBattery',
|
||||
desc: 'osdDescStatBattery'
|
||||
},
|
||||
MAX_G_FORCE: {
|
||||
name: 'MAX_G_FORCE',
|
||||
text: 'osdTextStatGForce',
|
||||
desc: 'osdDescStatGForce'
|
||||
},
|
||||
MAX_ESC_TEMP: {
|
||||
name: 'MAX_ESC_TEMP',
|
||||
text: 'osdTextStatEscTemperature',
|
||||
desc: 'osdDescStatEscTemperature'
|
||||
},
|
||||
MAX_ESC_RPM: {
|
||||
name: 'MAX_ESC_RPM',
|
||||
text: 'osdTextStatEscRpm',
|
||||
desc: 'osdDescStatEscRpm'
|
||||
},
|
||||
MIN_LINK_QUALITY: {
|
||||
name: 'MIN_LINK_QUALITY',
|
||||
text: 'osdTextStatMinLinkQuality',
|
||||
desc: 'osdDescStatMinLinkQuality'
|
||||
},
|
||||
FLIGHT_DISTANCE: {
|
||||
name: 'FLIGHT_DISTANCE',
|
||||
desc: 'osdDescStatFlightDistance'
|
||||
text: 'osdTextStatFlightDistance',
|
||||
desc: 'osdTextStatFlightDistance'
|
||||
},
|
||||
MAX_FFT: {
|
||||
name: 'MAX_FFT',
|
||||
text: 'osdTextStatMaxFFT',
|
||||
desc: 'osdDescStatMaxFFT'
|
||||
},
|
||||
TOTAL_FLIGHTS: {
|
||||
name: 'TOTAL_FLIGHTS',
|
||||
text: 'osdTextStatTotalFlights',
|
||||
desc: 'osdDescStatTotalFlights'
|
||||
},
|
||||
TOTAL_FLIGHT_TIME: {
|
||||
name: 'TOTAL_FLIGHT_TIME',
|
||||
text: 'osdTextStatTotalFlightTime',
|
||||
desc: 'osdDescStatTotalFlightTime'
|
||||
},
|
||||
TOTAL_FLIGHT_DIST: {
|
||||
name: 'TOTAL_FLIGHT_DIST',
|
||||
text: 'osdTextStatTotalFlightDistance',
|
||||
desc: 'osdDescStatTotalFlightDistance'
|
||||
}
|
||||
},
|
||||
|
@ -2066,11 +2091,11 @@ TABS.osd.initialize = function (callback) {
|
|||
$('.warnings-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpWarnings'));
|
||||
|
||||
function titleizeField(field) {
|
||||
let finalFieldName = inflection.titleize(field.name);
|
||||
let finalFieldName = null;
|
||||
if (field.text) {
|
||||
if (Array.isArray(field.text) && i18n.existsMessage(field.text[0])) {
|
||||
finalFieldName = i18n.getMessage(field.text[0], field.text.slice(1));
|
||||
} else if (i18n.existsMessage(field.text)) {
|
||||
} else {
|
||||
finalFieldName = i18n.getMessage(field.text);
|
||||
}
|
||||
}
|
||||
|
@ -2273,9 +2298,9 @@ TABS.osd.initialize = function (callback) {
|
|||
});
|
||||
})
|
||||
);
|
||||
$field.append('<label for="' + field.name + '" class="char-label">' + inflection.titleize(field.name) + '</label>');
|
||||
$field.append('<label for="' + field.name + '" class="char-label">' + titleizeField(field) + '</label>');
|
||||
|
||||
$statsFields.append($field);
|
||||
insertOrdered($statsFields, $field);
|
||||
}
|
||||
|
||||
// Warnings
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue