i18n final statistics from OSD

10.7.0-preview
Miguel Angel Mulero Martinez 2019-06-16 15:51:21 +02:00
parent 7f452d9c96
commit 2d5263996c
2 changed files with 130 additions and 5 deletions

View File

@ -4249,78 +4249,178 @@
"message": "Unknown element (details to be added in a future release)" "message": "Unknown element (details to be added in a future release)"
}, },
"osdTextStatMaxSpeed": {
"message": "Speed maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatMaxSpeed": { "osdDescStatMaxSpeed": {
"message": "Maximum recorded speed" "message": "Maximum recorded speed"
}, },
"osdTextStatMinBattery": {
"message": "Battery voltage minimum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatMinBattery": { "osdDescStatMinBattery": {
"message": "Minimum recorded main battery voltage" "message": "Minimum recorded main battery voltage"
}, },
"osdTextStatMinRssi": {
"message": "RSSI minimum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatMinRssi": { "osdDescStatMinRssi": {
"message": "Minimum recorded RSSI" "message": "Minimum recorded RSSI"
}, },
"osdTextStatMaxCurrent": {
"message": "Battery current draw maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatMaxCurrent": { "osdDescStatMaxCurrent": {
"message": "Maximum recorded current draw" "message": "Maximum recorded current draw"
}, },
"osdTextStatUsedMah": {
"message": "Battery mAh used",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatUsedMah": { "osdDescStatUsedMah": {
"message": "Battery capacity used" "message": "Battery capacity used"
}, },
"osdTextStatMaxAltitude": {
"message": "Altitude maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatMaxAltitude": { "osdDescStatMaxAltitude": {
"message": "Maximum recorded altitude" "message": "Maximum recorded altitude"
}, },
"osdTextStatBlackbox": {
"message": "Blackbox usage",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatBlackbox": { "osdDescStatBlackbox": {
"message": "Percentage of total blackbox use" "message": "Percentage of total blackbox use"
}, },
"osdTextStatEndBattery": {
"message": "Battery voltage end",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatEndBattery": { "osdDescStatEndBattery": {
"message": "Battery voltage at time of disarm" "message": "Battery voltage at time of disarm"
}, },
"osdTextStatFlyTime": {
"message": "Fly time total",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatFlyTime": { "osdDescStatFlyTime": {
"message": "Total time craft has been armed on current power cycle" "message": "Total time craft has been armed on current power cycle"
}, },
"osdTextStatArmedTime": {
"message": "Fly time last armed",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatArmedTime": { "osdDescStatArmedTime": {
"message": "Time since craft was last armed" "message": "Time since craft was last armed"
}, },
"osdTextStatMaxDistance": {
"message": "Home distance maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatMaxDistance": { "osdDescStatMaxDistance": {
"message": "Maximum distance from home location" "message": "Maximum distance from home location"
}, },
"osdTextStatBlackboxLogNumber": {
"message": "Blackbox number",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatBlackboxLogNumber": { "osdDescStatBlackboxLogNumber": {
"message": "Log number for this flights Blackbox log" "message": "Log number for this flights Blackbox log"
}, },
"osdTextStatTimer1": {
"message": "Timer 1",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatTimer1": { "osdDescStatTimer1": {
"message": "Value of timer 1 at time of disarming" "message": "Value of timer 1 at time of disarming"
}, },
"osdTextStatTimer2": {
"message": "Timer 2",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatTimer2": { "osdDescStatTimer2": {
"message": "Value of timer 2 at time of disarming" "message": "Value of timer 2 at time of disarming"
}, },
"osdTextStatRtcDateTime": {
"message": "RTC date and time",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatRtcDateTime": { "osdDescStatRtcDateTime": {
"message": "Date and time from real time clock" "message": "Date and time from real time clock"
}, },
"osdTextStatBattery": {
"message": "Battery voltage",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatBattery": { "osdDescStatBattery": {
"message": "Voltage of the battery in real time" "message": "Voltage of the battery in real time"
}, },
"osdTextStatGForce": {
"message": "G force maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatGForce": { "osdDescStatGForce": {
"message": "Max G-Force experienced by the craft" "message": "Max G-Force experienced by the craft"
}, },
"osdTextStatEscTemperature": {
"message": "ESC temperature maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatEscTemperature": { "osdDescStatEscTemperature": {
"message": "Max ESC temperature" "message": "Max ESC temperature"
}, },
"osdTextStatEscRpm": {
"message": "ESC RPM maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatEscRpm": { "osdDescStatEscRpm": {
"message": "Max ESC RPM" "message": "Max ESC RPM"
}, },
"osdTextStatMinLinkQuality": {
"message": "Link quality minimum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatMinLinkQuality": { "osdDescStatMinLinkQuality": {
"message": "Minimum of the alternative indicator for 'link quality' based on frame loss" "message": "Minimum of the alternative indicator for 'link quality' based on frame loss"
}, },
"osdTextStatFlightDistance": {
"message": "Flight distance",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatFlightDistance": { "osdDescStatFlightDistance": {
"message": "Total distance travelled during the flight" "message": "Total distance travelled during the flight"
}, },
"osdTextStatMaxFFT": {
"message": "FFT maximum",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatMaxFFT": { "osdDescStatMaxFFT": {
"message": "Peak FFT frequency" "message": "Peak FFT frequency"
}, },
"osdTextStatTotalFlights": {
"message": "Flights count total",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatTotalFlights": { "osdDescStatTotalFlights": {
"message": "Total number of flights" "message": "Total number of flights"
}, },
"osdTextStatTotalFlightTime": {
"message": "Fly time total",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatTotalFlightTime": { "osdDescStatTotalFlightTime": {
"message": "Total time spent flying" "message": "Total time spent flying"
}, },
"osdTextStatTotalFlightDistance": {
"message": "Flight distance total",
"description": "One of the statistics that can be shown at the end of the flight in the OSD"
},
"osdDescStatTotalFlightDistance": { "osdDescStatTotalFlightDistance": {
"message": "Total distance traveled" "message": "Total distance traveled"
}, },

View File

@ -1111,102 +1111,127 @@ OSD.constants = {
ALL_STATISTIC_FIELDS: { ALL_STATISTIC_FIELDS: {
MAX_SPEED: { MAX_SPEED: {
name: 'MAX_SPEED', name: 'MAX_SPEED',
text: 'osdTextStatMaxSpeed',
desc: 'osdDescStatMaxSpeed' desc: 'osdDescStatMaxSpeed'
}, },
MIN_BATTERY: { MIN_BATTERY: {
name: 'MIN_BATTERY', name: 'MIN_BATTERY',
text: 'osdTextStatMinBattery',
desc: 'osdDescStatMinBattery' desc: 'osdDescStatMinBattery'
}, },
MIN_RSSI: { MIN_RSSI: {
name: 'MIN_RSSI', name: 'MIN_RSSI',
text: 'osdTextStatMinRssi',
desc: 'osdDescStatMinRssi' desc: 'osdDescStatMinRssi'
}, },
MAX_CURRENT: { MAX_CURRENT: {
name: 'MAX_CURRENT', name: 'MAX_CURRENT',
text: 'osdTextStatMaxCurrent',
desc: 'osdDescStatMaxCurrent' desc: 'osdDescStatMaxCurrent'
}, },
USED_MAH: { USED_MAH: {
name: 'USED_MAH', name: 'USED_MAH',
text: 'osdTextStatUsedMah',
desc: 'osdDescStatUsedMah' desc: 'osdDescStatUsedMah'
}, },
MAX_ALTITUDE: { MAX_ALTITUDE: {
name: 'MAX_ALTITUDE', name: 'MAX_ALTITUDE',
text: 'osdTextStatMaxAltitude',
desc: 'osdDescStatMaxAltitude' desc: 'osdDescStatMaxAltitude'
}, },
BLACKBOX: { BLACKBOX: {
name: 'BLACKBOX', name: 'BLACKBOX',
text: 'osdTextStatBlackbox',
desc: 'osdDescStatBlackbox' desc: 'osdDescStatBlackbox'
}, },
END_BATTERY: { END_BATTERY: {
name: 'END_BATTERY', name: 'END_BATTERY',
text: 'osdTextStatEndBattery',
desc: 'osdDescStatEndBattery' desc: 'osdDescStatEndBattery'
}, },
FLYTIME: { FLYTIME: {
name: 'FLY_TIME', name: 'FLY_TIME',
text: 'osdTextStatFlyTime',
desc: 'osdDescStatFlyTime' desc: 'osdDescStatFlyTime'
}, },
ARMEDTIME: { ARMEDTIME: {
name: 'ARMED_TIME', name: 'ARMED_TIME',
text: 'osdTextStatArmedTime',
desc: 'osdDescStatArmedTime' desc: 'osdDescStatArmedTime'
}, },
MAX_DISTANCE: { MAX_DISTANCE: {
name: 'MAX_DISTANCE', name: 'MAX_DISTANCE',
text: 'osdTextStatMaxDistance',
desc: 'osdDescStatMaxDistance' desc: 'osdDescStatMaxDistance'
}, },
BLACKBOX_LOG_NUMBER: { BLACKBOX_LOG_NUMBER: {
name: 'BLACKBOX_LOG_NUMBER', name: 'BLACKBOX_LOG_NUMBER',
text: 'osdTextStatBlackboxLogNumber',
desc: 'osdDescStatBlackboxLogNumber' desc: 'osdDescStatBlackboxLogNumber'
}, },
TIMER_1: { TIMER_1: {
name: 'TIMER_1', name: 'TIMER_1',
text: 'osdTextStatTimer1',
desc: 'osdDescStatTimer1' desc: 'osdDescStatTimer1'
}, },
TIMER_2: { TIMER_2: {
name: 'TIMER_2', name: 'TIMER_2',
text: 'osdTextStatTimer2',
desc: 'osdDescStatTimer2' desc: 'osdDescStatTimer2'
}, },
RTC_DATE_TIME: { RTC_DATE_TIME: {
name: 'RTC_DATE_TIME', name: 'RTC_DATE_TIME',
text: 'osdTextStatRtcDateTime',
desc: 'osdDescStatRtcDateTime' desc: 'osdDescStatRtcDateTime'
}, },
STAT_BATTERY: { STAT_BATTERY: {
name: 'BATTERY_VOLTAGE', name: 'BATTERY_VOLTAGE',
text: 'osdTextStatBattery',
desc: 'osdDescStatBattery' desc: 'osdDescStatBattery'
}, },
MAX_G_FORCE: { MAX_G_FORCE: {
name: 'MAX_G_FORCE', name: 'MAX_G_FORCE',
text: 'osdTextStatGForce',
desc: 'osdDescStatGForce' desc: 'osdDescStatGForce'
}, },
MAX_ESC_TEMP: { MAX_ESC_TEMP: {
name: 'MAX_ESC_TEMP', name: 'MAX_ESC_TEMP',
text: 'osdTextStatEscTemperature',
desc: 'osdDescStatEscTemperature' desc: 'osdDescStatEscTemperature'
}, },
MAX_ESC_RPM: { MAX_ESC_RPM: {
name: 'MAX_ESC_RPM', name: 'MAX_ESC_RPM',
text: 'osdTextStatEscRpm',
desc: 'osdDescStatEscRpm' desc: 'osdDescStatEscRpm'
}, },
MIN_LINK_QUALITY: { MIN_LINK_QUALITY: {
name: 'MIN_LINK_QUALITY', name: 'MIN_LINK_QUALITY',
text: 'osdTextStatMinLinkQuality',
desc: 'osdDescStatMinLinkQuality' desc: 'osdDescStatMinLinkQuality'
}, },
FLIGHT_DISTANCE: { FLIGHT_DISTANCE: {
name: 'FLIGHT_DISTANCE', name: 'FLIGHT_DISTANCE',
desc: 'osdDescStatFlightDistance' text: 'osdTextStatFlightDistance',
desc: 'osdTextStatFlightDistance'
}, },
MAX_FFT: { MAX_FFT: {
name: 'MAX_FFT', name: 'MAX_FFT',
text: 'osdTextStatMaxFFT',
desc: 'osdDescStatMaxFFT' desc: 'osdDescStatMaxFFT'
}, },
TOTAL_FLIGHTS: { TOTAL_FLIGHTS: {
name: 'TOTAL_FLIGHTS', name: 'TOTAL_FLIGHTS',
text: 'osdTextStatTotalFlights',
desc: 'osdDescStatTotalFlights' desc: 'osdDescStatTotalFlights'
}, },
TOTAL_FLIGHT_TIME: { TOTAL_FLIGHT_TIME: {
name: 'TOTAL_FLIGHT_TIME', name: 'TOTAL_FLIGHT_TIME',
text: 'osdTextStatTotalFlightTime',
desc: 'osdDescStatTotalFlightTime' desc: 'osdDescStatTotalFlightTime'
}, },
TOTAL_FLIGHT_DIST: { TOTAL_FLIGHT_DIST: {
name: 'TOTAL_FLIGHT_DIST', name: 'TOTAL_FLIGHT_DIST',
text: 'osdTextStatTotalFlightDistance',
desc: 'osdDescStatTotalFlightDistance' desc: 'osdDescStatTotalFlightDistance'
} }
}, },
@ -2066,11 +2091,11 @@ TABS.osd.initialize = function (callback) {
$('.warnings-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpWarnings')); $('.warnings-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpWarnings'));
function titleizeField(field) { function titleizeField(field) {
let finalFieldName = inflection.titleize(field.name); let finalFieldName = null;
if (field.text) { if (field.text) {
if (Array.isArray(field.text) && i18n.existsMessage(field.text[0])) { if (Array.isArray(field.text) && i18n.existsMessage(field.text[0])) {
finalFieldName = i18n.getMessage(field.text[0], field.text.slice(1)); finalFieldName = i18n.getMessage(field.text[0], field.text.slice(1));
} else if (i18n.existsMessage(field.text)) { } else {
finalFieldName = i18n.getMessage(field.text); 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 // Warnings