From e1896a3c2d3ad6911857d7f60ab1b6ea718e4aa5 Mon Sep 17 00:00:00 2001 From: Miguel Angel Mulero Martinez Date: Thu, 13 Jun 2019 20:21:34 +0200 Subject: [PATCH] i18n some static options from the OSD --- locales/en/messages.json | 63 ++++++++++++++++++++++++++++++++++++++++ src/js/tabs/osd.js | 30 ++++++++++--------- 2 files changed, 79 insertions(+), 14 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 34acb9de..5a121105 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -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)" diff --git a/src/js/tabs/osd.js b/src/js/tabs/osd.js index 5819433f..a5280751 100644 --- a/src/js/tabs/osd.js +++ b/src/js/tabs/osd.js @@ -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 = $('') + var $checkbox = $('') .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 = $('') + var $checkbox = $('') .prop('checked', i === OSD.data.unit_mode) .data('type', type) .data('type', i) @@ -2112,7 +2116,7 @@ TABS.osd.initialize = function (callback) { sourceTimerTableData.append(''); var src = $(''); OSD.constants.TIMER_TYPES.forEach(function (e, i) { - src.append(''); + src.append(''); }); src[0].selectedIndex = tim.src; src.blur(function (e) { @@ -2134,7 +2138,7 @@ TABS.osd.initialize = function (callback) { precisionTimerTableData.append(''); var precision = $(''); OSD.constants.TIMER_PRECISION.forEach(function (e, i) { - precision.append(''); + precision.append(''); }); 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})); }); } });