mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-17 13:25:22 +03:00
started moving messages to translation system
This commit is contained in:
parent
c3aa3a3fab
commit
e1ceee4fa4
3 changed files with 91 additions and 33 deletions
|
@ -9,6 +9,70 @@
|
||||||
"message": "Send anonymous usage data to the developer team"
|
"message": "Send anonymous usage data to the developer team"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"connect": {
|
||||||
|
"message": "Connect"
|
||||||
|
},
|
||||||
|
"connecting": {
|
||||||
|
"message": "Connecting"
|
||||||
|
},
|
||||||
|
"disconnect": {
|
||||||
|
"message": "Disconnect"
|
||||||
|
},
|
||||||
|
"autoConnect": {
|
||||||
|
"message": "Auto-Connect"
|
||||||
|
},
|
||||||
|
"autoConnectEnabled": {
|
||||||
|
"message": "Auto-Connect: Enabled - Configurator automatically tries to connect when new port is detected"
|
||||||
|
},
|
||||||
|
"autoConnectDisabled": {
|
||||||
|
"message": "Auto-Connect: Disabled - User needs to select the correct serial port and click \"Connect\" button on its own"
|
||||||
|
},
|
||||||
|
|
||||||
|
"tab1": {
|
||||||
|
"message": "Initial Setup"
|
||||||
|
},
|
||||||
|
"tab2": {
|
||||||
|
"message": "PID Tuning"
|
||||||
|
},
|
||||||
|
"tab3": {
|
||||||
|
"message": "Receiver"
|
||||||
|
},
|
||||||
|
"tab4": {
|
||||||
|
"message": "Auxiliary Configuration"
|
||||||
|
},
|
||||||
|
"tab5": {
|
||||||
|
"message": "Servos"
|
||||||
|
},
|
||||||
|
"tab6": {
|
||||||
|
"message": "GPS"
|
||||||
|
},
|
||||||
|
"tab7": {
|
||||||
|
"message": "Motor/Servo Outputs"
|
||||||
|
},
|
||||||
|
"tab8": {
|
||||||
|
"message": "Raw Sensor Data"
|
||||||
|
},
|
||||||
|
"tab9": {
|
||||||
|
"message": "CLI"
|
||||||
|
},
|
||||||
|
|
||||||
|
"serialPortOpened": {
|
||||||
|
"message": "Serial port <span style=\"color: green\">successfully</span> opened with ID: $1"
|
||||||
|
},
|
||||||
|
"serialPortClosedOk": {
|
||||||
|
"message": "Serial port <span style=\"color: green\">successfully</span> closed"
|
||||||
|
},
|
||||||
|
"serialPortClosedFail": {
|
||||||
|
"message": "<span style=\"color: red\">Failed</span> to close serial port"
|
||||||
|
},
|
||||||
|
|
||||||
|
"noConfigurationReceived": {
|
||||||
|
"message": "No configuration received within <span style=\"color: red\">10 seconds</span>, communication <span style=\"color: red\">failed</span>"
|
||||||
|
},
|
||||||
|
"firmwareVersionNotSupported": {
|
||||||
|
"message": "This firmware version is <span style=\"color: red\">not supported</span>. Please upgrade to version <strong>$1</strong> or higher"
|
||||||
|
},
|
||||||
|
|
||||||
"notifications_app_just_updated_to_version": {
|
"notifications_app_just_updated_to_version": {
|
||||||
"message": "Application just updated to version: $1"
|
"message": "Application just updated to version: $1"
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,7 +17,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// lock port select & baud while we are connecting / connected
|
// lock port select & baud while we are connecting / connected
|
||||||
$('div#port-picker #port, div#port-picker #baud, div#port-picker #delay').prop('disabled', true);
|
$('div#port-picker #port, div#port-picker #baud, div#port-picker #delay').prop('disabled', true);
|
||||||
$('div#port-picker a.connect').text('Connecting');
|
$('div#port-picker a.connect').text(chrome.i18n.getMessage('connecting'));
|
||||||
|
|
||||||
serial.connect(selected_port, {bitrate: selected_baud}, onOpen);
|
serial.connect(selected_port, {bitrate: selected_baud}, onOpen);
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,7 +43,7 @@ $(document).ready(function() {
|
||||||
$('div#port-picker #port').prop('disabled', false);
|
$('div#port-picker #port').prop('disabled', false);
|
||||||
if (!GUI.auto_connect) $('div#port-picker #baud').prop('disabled', false);
|
if (!GUI.auto_connect) $('div#port-picker #baud').prop('disabled', false);
|
||||||
|
|
||||||
$(this).text('Connect');
|
$(this).text(chrome.i18n.getMessage('connect'));
|
||||||
$(this).removeClass('active');
|
$(this).removeClass('active');
|
||||||
|
|
||||||
sensor_status(sensors_detected = 0); // reset active sensor indicators
|
sensor_status(sensors_detected = 0); // reset active sensor indicators
|
||||||
|
@ -68,7 +68,7 @@ $(document).ready(function() {
|
||||||
GUI.auto_connect = true;
|
GUI.auto_connect = true;
|
||||||
|
|
||||||
$('input.auto_connect').prop('checked', true);
|
$('input.auto_connect').prop('checked', true);
|
||||||
$('input.auto_connect, span.auto_connect').prop('title', 'Auto-Connect: Enabled - Configurator automatically tries to connect when new port is detected');
|
$('input.auto_connect, span.auto_connect').prop('title', chrome.i18n.getMessage('autoConnectEnabled'));
|
||||||
$('select#baud').val(115200).prop('disabled', true);
|
$('select#baud').val(115200).prop('disabled', true);
|
||||||
|
|
||||||
// save
|
// save
|
||||||
|
@ -79,7 +79,7 @@ $(document).ready(function() {
|
||||||
GUI.auto_connect = true;
|
GUI.auto_connect = true;
|
||||||
|
|
||||||
$('input.auto_connect').prop('checked', true);
|
$('input.auto_connect').prop('checked', true);
|
||||||
$('input.auto_connect, span.auto_connect').prop('title', 'Auto-Connect: Enabled - Configurator automatically tries to connect when new serial port is detected');
|
$('input.auto_connect, span.auto_connect').prop('title', chrome.i18n.getMessage('autoConnectEnabled'));
|
||||||
|
|
||||||
$('select#baud').val(115200).prop('disabled', true);
|
$('select#baud').val(115200).prop('disabled', true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -87,7 +87,7 @@ $(document).ready(function() {
|
||||||
GUI.auto_connect = false;
|
GUI.auto_connect = false;
|
||||||
|
|
||||||
$('input.auto_connect').prop('checked', false);
|
$('input.auto_connect').prop('checked', false);
|
||||||
$('input.auto_connect, span.auto_connect').prop('title', 'Auto-Connect: Disabled - User needs to select the correct serial port and click "Connect" button on its own');
|
$('input.auto_connect, span.auto_connect').prop('title', chrome.i18n.getMessage('autoConnectDisabled'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +97,11 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// update title/tooltip
|
// update title/tooltip
|
||||||
if (GUI.auto_connect) {
|
if (GUI.auto_connect) {
|
||||||
$('input.auto_connect, span.auto_connect').prop('title', 'Auto-Connect: Enabled - Configurator automatically tries to connect when new port is detected');
|
$('input.auto_connect, span.auto_connect').prop('title', chrome.i18n.getMessage('autoConnectEnabled'));
|
||||||
|
|
||||||
$('select#baud').val(115200).prop('disabled', true);
|
$('select#baud').val(115200).prop('disabled', true);
|
||||||
} else {
|
} else {
|
||||||
$('input.auto_connect, span.auto_connect').prop('title', 'Auto-Connect: Disabled - User needs to select the correct serial port and click "Connect" button on its own');
|
$('input.auto_connect, span.auto_connect').prop('title', chrome.i18n.getMessage('autoConnectDisabled'));
|
||||||
|
|
||||||
if (!GUI.connected_to && !GUI.connecting_to) $('select#baud').prop('disabled', false);
|
if (!GUI.connected_to && !GUI.connecting_to) $('select#baud').prop('disabled', false);
|
||||||
}
|
}
|
||||||
|
@ -122,24 +122,18 @@ function onOpen(openInfo) {
|
||||||
// reset connecting_to
|
// reset connecting_to
|
||||||
GUI.connecting_to = false;
|
GUI.connecting_to = false;
|
||||||
|
|
||||||
GUI.log('Serial port <span style="color: green">successfully</span> opened with ID: ' + openInfo.connectionId);
|
GUI.log(chrome.i18n.getMessage('serialPortOpened', [openInfo.connectionId]));
|
||||||
|
|
||||||
// save selected port with chrome.storage if the port differs
|
// save selected port with chrome.storage if the port differs
|
||||||
chrome.storage.local.get('last_used_port', function(result) {
|
chrome.storage.local.get('last_used_port', function(result) {
|
||||||
if (typeof result.last_used_port != 'undefined') {
|
if (typeof result.last_used_port != 'undefined') {
|
||||||
if (result.last_used_port != GUI.connected_to) {
|
if (result.last_used_port != GUI.connected_to) {
|
||||||
// last used port doesn't match the one found in local db, we will store the new one
|
// last used port doesn't match the one found in local db, we will store the new one
|
||||||
chrome.storage.local.set({'last_used_port': GUI.connected_to}, function() {
|
chrome.storage.local.set({'last_used_port': GUI.connected_to});
|
||||||
// Debug message is currently disabled (we dont need to spam the console log with that)
|
|
||||||
// console.log('Last selected port was saved in chrome.storage.');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// variable isn't stored yet, saving
|
// variable isn't stored yet, saving
|
||||||
chrome.storage.local.set({'last_used_port': GUI.connected_to}, function() {
|
chrome.storage.local.set({'last_used_port': GUI.connected_to});
|
||||||
// Debug message is currently disabled (we dont need to spam the console log with that)
|
|
||||||
// console.log('Last selected port was saved in chrome.storage.');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -148,7 +142,7 @@ function onOpen(openInfo) {
|
||||||
// disconnect after 10 seconds with error if we don't get IDENT data
|
// disconnect after 10 seconds with error if we don't get IDENT data
|
||||||
GUI.timeout_add('connecting', function() {
|
GUI.timeout_add('connecting', function() {
|
||||||
if (!configuration_received) {
|
if (!configuration_received) {
|
||||||
GUI.log('No configuration received within <span style="color: red">10 seconds</span>, communication <span style="color: red">failed</span>');
|
GUI.log(chrome.i18n.getMessage('noConfigurationReceived'));
|
||||||
|
|
||||||
$('div#port-picker a.connect').click(); // disconnect
|
$('div#port-picker a.connect').click(); // disconnect
|
||||||
}
|
}
|
||||||
|
@ -165,10 +159,10 @@ function onOpen(openInfo) {
|
||||||
if (CONFIG.version >= firmware_version_accepted) {
|
if (CONFIG.version >= firmware_version_accepted) {
|
||||||
configuration_received = true;
|
configuration_received = true;
|
||||||
|
|
||||||
$('div#port-picker a.connect').text('Disconnect').addClass('active');
|
$('div#port-picker a.connect').text(chrome.i18n.getMessage('disconnect')).addClass('active');
|
||||||
$('#tabs li a:first').click();
|
$('#tabs li a:first').click();
|
||||||
} else {
|
} else {
|
||||||
GUI.log('This firmware version is <span style="color: red">not supported</span>. Please upgrade to version <strong>' + firmware_version_accepted + '</strong> or higher.');
|
GUI.log(chrome.i18n.getMessage('firmwareVersionNotSupported', [firmware_version_accepted]));
|
||||||
$('div#port-picker a.connect').click(); // disconnect
|
$('div#port-picker a.connect').click(); // disconnect
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -190,9 +184,9 @@ function onOpen(openInfo) {
|
||||||
|
|
||||||
function onClosed(result) {
|
function onClosed(result) {
|
||||||
if (result) { // All went as expected
|
if (result) { // All went as expected
|
||||||
GUI.log('Serial port <span style="color: green">successfully</span> closed');
|
GUI.log(chrome.i18n.getMessage('serialPortClosedOk'));
|
||||||
} else { // Something went wrong
|
} else { // Something went wrong
|
||||||
GUI.log('<span style="color: red">Failed</span> to close serial port');
|
GUI.log(chrome.i18n.getMessage('serialPortClosedFail'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
main.html
24
main.html
|
@ -70,10 +70,10 @@
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="connect" href="#" title="">Connect</a>
|
<a class="connect" href="#" i18n="connect"></a>
|
||||||
<label>
|
<label>
|
||||||
<input class="auto_connect" type="checkbox" title="Auto-Connect" />
|
<input class="auto_connect" type="checkbox" />
|
||||||
<span class="auto_connect">Auto-Connect</span>
|
<span class="auto_connect" i18n="autoConnect"></span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -96,15 +96,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="tabs">
|
<div id="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="tab_initial_setup"><a href="#">Initial Setup</a></li>
|
<li class="tab_initial_setup"><a href="#" i18n="tab1"></a></li>
|
||||||
<li class="tab_pid_tuning"><a href="#">PID Tuning</a></li>
|
<li class="tab_pid_tuning"><a href="#" i18n="tab2"></a></li>
|
||||||
<li class="tab_receiver"><a href="#">Receiver</a></li>
|
<li class="tab_receiver"><a href="#" i18n="tab3"></a></li>
|
||||||
<li class="tab_auxiliary_configuration"><a href="#">Auxiliary Configuration</a></li>
|
<li class="tab_auxiliary_configuration"><a href="#" i18n="tab4"></a></li>
|
||||||
<li class="tab_servos"><a href="#">Servos</a></li>
|
<li class="tab_servos"><a href="#" i18n="tab5"></a></li>
|
||||||
<li class="tab_gps"><a href="#">GPS</a></li>
|
<li class="tab_gps"><a href="#" i18n="tab6"></a></li>
|
||||||
<li class="tab_motor_outputs"><a href="#">Motor/Servo Outputs</a></li>
|
<li class="tab_motor_outputs"><a href="#" i18n="tab7"></a></li>
|
||||||
<li class="tab_sensors"><a href="#">Raw Sensor Data</a></li>
|
<li class="tab_sensors"><a href="#" i18n="tab8"></a></li>
|
||||||
<li class="tab_cli"><a href="#">CLI</a></li>
|
<li class="tab_cli"><a href="#" i18n="tab9"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clear-both"></div>
|
<div class="clear-both"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue