1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 16:55:24 +03:00

i18n some static options from the OSD

This commit is contained in:
Miguel Angel Mulero Martinez 2019-06-13 20:21:34 +02:00
parent ac798c9813
commit e1896a3c2d
2 changed files with 79 additions and 14 deletions

View file

@ -3669,9 +3669,29 @@
"osdSetupVideoFormatTitle": {
"message": "Video Format"
},
"osdSetupVideoFormatOptionAuto": {
"message": "Auto",
"description": "Option for the video format in the OSD"
},
"osdSetupVideoFormatOptionPal": {
"message": "PAL",
"description": "Option for the video format in the OSD"
},
"osdSetupVideoFormatOptionNtsc": {
"message": "NTSC",
"description": "Option for the video format in the OSD"
},
"osdSetupUnitsTitle": {
"message": "Units"
},
"osdSetupUnitsOptionImperial": {
"message": "Imperial",
"description": "Option for the units system used in the OSD"
},
"osdSetupUnitsOptionMetric": {
"message": "Metric",
"description": "Option for the units system used in the OSD"
},
"osdSetupTimersTitle": {
"message": "Timers"
},
@ -3736,6 +3756,9 @@
"osdSetupUploadingFont": {
"message": "Uploading..."
},
"osdSetupUploadingFontEnd": {
"message": "Uploaded all {{length}} characters to the OSD"
},
"osdSetupSave": {
"message": "Save"
@ -4310,18 +4333,58 @@
"osdTimerSourceTooltip": {
"message": "Select the timer source, this controls the duration/event that the timer measures"
},
"osdTimerSourceOptionOnTime": {
"message": "On time",
"description": "One of the options for the source timer. This options shows the amount of time has passed since the battery was plugged"
},
"osdTimerSourceOptionTotalArmedTime": {
"message": "Total armed time",
"description": "One of the options for the source timer. This options shows the amount of time the craft was armed since the battery was plugged"
},
"osdTimerSourceOptionLastArmedTime": {
"message": "Last armed time",
"description": "One of the options for the source timer. This options shows the amount of time the craft was armed the latest time"
},
"osdTimerSourceOptionOnArmTime": {
"message": "On/Armed time",
"description": "One of the options for the source timer. This option shows On time when craft is disarmed, and Armed time when armed"
},
"osdTimerPrecision": {
"message": "Precision:"
},
"osdTimerPrecisionTooltip": {
"message": "Select the timer precision, this controls to what precision the time is reported in"
},
"osdTimerPrecisionOptionSecond": {
"message": "Second",
"description": "Selectable option for the precision of the timer in the OSD"
},
"osdTimerPrecisionOptionHundredth": {
"message": "Hundredth",
"description": "Selectable option for the precision of the timer in the OSD"
},
"osdTimerPrecisionOptionTenth": {
"message": "Tenth",
"description": "Selectable option for the precision of the timer in the OSD"
},
"osdTimerAlarm": {
"message": "Alarm:"
},
"osdTimerAlarmTooltip": {
"message": "Select the timer alarm threshold in minutes, when the time exceeds this value the OSD element will blink, setting this to 0 disables the alarm"
},
"osdTimerAlarmOptionRssi": {
"message": "RSSI",
"description": "Text of the RSSI alarm"
},
"osdTimerAlarmOptionCapacity": {
"message": "Capacity",
"description": "Text of the capacity alarm"
},
"osdTimerAlarmOptionAltitude": {
"message": "Altitude",
"description": "Text of the altitude alarm"
},
"osdWarningUnknown": {
"message": "Unknown warning (details to be added in a future release)"

View file

@ -242,6 +242,10 @@ FONT.upload = function ($progress) {
return MSP.promise(MSPCodes.MSP_OSD_CHAR_WRITE, FONT.msp.encode(i));
})
.then(function () {
console.log('Uploaded all ' + FONT.data.characters.length + ' characters');
GUI.log(i18n.getMessage('osdSetupUploadingFontEnd', {length: FONT.data.characters.length}));
OSD.GUI.fontManager.close();
return MSP.promise(MSPCodes.MSP_SET_REBOOT);
@ -1523,13 +1527,13 @@ OSD.chooseFields = function () {
}
OSD.constants.TIMER_TYPES = [
'ON TIME',
'TOTAL ARMED TIME',
'LAST ARMED TIME'
'ON_TIME',
'TOTAL_ARMED_TIME',
'LAST_ARMED_TIME'
];
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
OSD.constants.TIMER_TYPES = OSD.constants.TIMER_TYPES.concat([
'ON/ARM TIME'
'ON_ARM_TIME'
]);
OSD.constants.WARNINGS = OSD.constants.WARNINGS.concat([
F.RSSI,
@ -1699,8 +1703,8 @@ OSD.msp = {
if (semver.gte(CONFIG.apiVersion, "1.21.0") && bit_check(d.flags, 0)) {
d.unit_mode = view.readU8();
d.alarms = {};
d.alarms['rssi'] = { display_name: 'Rssi', value: view.readU8() };
d.alarms['cap'] = { display_name: 'Capacity', value: view.readU16() };
d.alarms['rssi'] = { display_name: i18n.getMessage('osdTimerAlarmOptionRssi'), value: view.readU8() };
d.alarms['cap'] = { display_name: i18n.getMessage('osdTimerAlarmOptionCapacity'), value: view.readU16() };
if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
d.alarms['time'] = { display_name: 'Minutes', value: view.readU16() };
} else {
@ -1712,7 +1716,7 @@ OSD.msp = {
}
}
d.alarms['alt'] = { display_name: 'Altitude', value: view.readU16() };
d.alarms['alt'] = { display_name: i18n.getMessage('osdTimerAlarmOptionAltitude'), value: view.readU16() };
}
}
}
@ -2039,7 +2043,7 @@ TABS.osd.initialize = function (callback) {
var $videoTypes = $('.video-types').empty();
for (var i = 0; i < OSD.constants.VIDEO_TYPES.length; i++) {
var type = OSD.constants.VIDEO_TYPES[i];
var $checkbox = $('<label/>').append($('<input name="video_system" type="radio"/>' + type + '</label>')
var $checkbox = $('<label/>').append($('<input name="video_system" type="radio"/>' + i18n.getMessage('osdSetupVideoFormatOption' + inflection.camelize(type.toLowerCase())) + '</label>')
.prop('checked', i === OSD.data.video_system)
.data('type', type)
.data('type', i)
@ -2060,7 +2064,7 @@ TABS.osd.initialize = function (callback) {
var $unitMode = $('.units').empty();
for (var i = 0; i < OSD.constants.UNIT_TYPES.length; i++) {
var type = OSD.constants.UNIT_TYPES[i];
var $checkbox = $('<label/>').append($('<input name="unit_mode" type="radio"/>' + type + '</label>')
var $checkbox = $('<label/>').append($('<input name="unit_mode" type="radio"/>' + i18n.getMessage('osdSetupUnitsOption' + inflection.camelize(type.toLowerCase())) + '</label>')
.prop('checked', i === OSD.data.unit_mode)
.data('type', type)
.data('type', i)
@ -2112,7 +2116,7 @@ TABS.osd.initialize = function (callback) {
sourceTimerTableData.append('<label for="timerSource_' + tim.index + '" class="char-label">' + i18n.getMessage('osdTimerSource') + '</label>');
var src = $('<select class="timer-option" id="timerSource_' + tim.index + '"></select>');
OSD.constants.TIMER_TYPES.forEach(function (e, i) {
src.append('<option value="' + i + '">' + e + '</option>');
src.append('<option value="' + i + '">' + i18n.getMessage('osdTimerSourceOption' + inflection.camelize(e.toLowerCase())) + '</option>');
});
src[0].selectedIndex = tim.src;
src.blur(function (e) {
@ -2134,7 +2138,7 @@ TABS.osd.initialize = function (callback) {
precisionTimerTableData.append('<label for="timerPrec_' + tim.index + '" class="char-label">' + i18n.getMessage('osdTimerPrecision') + '</label>');
var precision = $('<select class="timer-option osd_tip" id="timerPrec_' + tim.index + '"></select>');
OSD.constants.TIMER_PRECISION.forEach(function (e, i) {
precision.append('<option value="' + i + '">' + e + '</option>');
precision.append('<option value="' + i + '">' + i18n.getMessage('osdTimerPrecisionOption' + inflection.camelize(e.toLowerCase())) + '</option>');
});
precision[0].selectedIndex = tim.precision;
precision.blur(function (e) {
@ -2604,9 +2608,7 @@ TABS.osd.initialize = function (callback) {
$('a.flash_font').addClass('disabled');
$('.progressLabel').text(i18n.getMessage('osdSetupUploadingFont'));
FONT.upload($('.progress').val(0)).then(function () {
var msg = 'Uploaded all ' + FONT.data.characters.length + ' characters';
console.log(msg);
$('.progressLabel').text(msg);
$('.progressLabel').text(i18n.getMessage('osdSetupUploadingFontEnd', {length: FONT.data.characters.length}));
});
}
});