Skip to content

Commit

Permalink
Merge branch 'master' into ToshihiroMakuuchi/ja-fix01
Browse files Browse the repository at this point in the history
  • Loading branch information
sensei-hacker authored Dec 13, 2024
2 parents 88fbdef + f454d6e commit 5f25766
Show file tree
Hide file tree
Showing 19 changed files with 6,549 additions and 73 deletions.
18 changes: 10 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html i18n_lang="currentLanguage">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Expand Down Expand Up @@ -88,13 +88,7 @@ <h1 class="modal__title modal__title" data-i18n="appUpdateNotificationHeader"></
</div>
</div>
<div class="header-wrapper">
<div id="dataflash_wrapper_global">
<div class="noflash_global" align="center" i18n="sensorDataFlashNotFound"></div>
<ul class="dataflash-contents_global">
<li class="dataflash-free_global">
<div class="legend" i18n="sensorDataFlashFreeSpace"></div>
</li>
</ul>
<div id="profiles_wrapper_global">
<div id="profile_change">
<div class="dropdown dropdown-dark">
<form name="profile-change" id="profile-change">
Expand Down Expand Up @@ -130,6 +124,14 @@ <h1 class="modal__title modal__title" data-i18n="appUpdateNotificationHeader"></
</div>
</div>
</div>
<div id="dataflash_wrapper_global">
<div class="noflash_global" align="center" i18n="sensorDataFlashNotFound"></div>
<ul class="dataflash-contents_global">
<li class="dataflash-free_global">
<div class="legend" i18n="sensorDataFlashFreeSpace"></div>
</li>
</ul>
</div>
<div id="sensor-status" class="sensor_state mode-connected">
<ul>
<li class="gyro" i18n_title="sensorStatusGyro">
Expand Down
2 changes: 1 addition & 1 deletion js/data_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var CONFIGURATOR = {
// all versions are specified and compared using semantic versioning http://semver.org/
'minfirmwareVersionAccepted': '7.0.0',
'minfirmwareVersionAccepted': '8.0.0',
'maxFirmwareVersionAccepted': '9.0.0', // Condition is < (lt) so we accept all in 8.x branch
'connectionValid': false,
'connectionValidCliOnly': false,
Expand Down
2 changes: 1 addition & 1 deletion js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ GUI_control.prototype.update_dataflash_global = function () {
width: (100-(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize) / FC.DATAFLASH.totalSize * 100) + "%",
display: 'block'
});
$(".dataflash-free_global div").text('Dataflash: free ' + formatFilesize(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize));
$(".dataflash-free_global div").html(i18n.getMessage('sensorDataFlashFreeSpace') + formatFilesize(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize));
} else {
$(".noflash_global").css({
display: 'block'
Expand Down
15 changes: 14 additions & 1 deletion js/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const i18nextXHRBackend = require('i18next-xhr-backend');
const Store = require('electron-store');
const store = new Store();

const availableLanguages = ['en', 'ja', 'uk'];

const availableLanguages = ['en', 'ja', 'uk','zh_CN'];

const i18n = {};

Expand Down Expand Up @@ -173,6 +174,11 @@ i18n.localize = function (reTranslate = false) {
const element = $(this);
element.attr('placeholder', translate(element.attr('i18n_placeholder')));
});

$('[i18n_lang]').each(function() {
const element = $(this);
element.attr('lang', translate(element.attr('i18n_lang')));
});
} else {

$('[i18n]:not(.i18n-replaced)').each(function() {
Expand Down Expand Up @@ -234,6 +240,13 @@ i18n.localize = function (reTranslate = false) {
element.attr('placeholder', translate(element.attr('i18n_placeholder')));
element.addClass('i18n_placeholder-replaced');
});

$('[i18n_lang]:not(.i18n_lang-replaced)').each(function() {
const element = $(this);
element.attr('lang', translate(element.attr('i18n_lang')));
element.addClass('i18n_lang-replaced');
});

}

return localized;
Expand Down
3 changes: 2 additions & 1 deletion js/serial_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ var SerialBackend = (function () {
$('#sensor-status').show();
$('#portsinput').hide();
$('#dataflash_wrapper_global').show();
$('#profiles_wrapper_global').show();

/*
* Init PIDs bank with a length that depends on the version
Expand All @@ -481,7 +482,6 @@ var SerialBackend = (function () {

interval.add('global_data_refresh', periodicStatusUpdater.run, periodicStatusUpdater.getUpdateInterval(CONFIGURATOR.connection.bitrate), false);
});

}

privateScope.onClosed = function (result) {
Expand All @@ -497,6 +497,7 @@ var SerialBackend = (function () {
$('#sensor-status').hide();
$('#portsinput').show();
$('#dataflash_wrapper_global').hide();
$('#profiles_wrapper_global').hide();
$('#quad-status_wrapper').hide();

//updateFirmwareVersion();
Expand Down
14 changes: 11 additions & 3 deletions js/ublox/UBLOX.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ var ublox = (function () {

if (successCallback != null) {
req.onload = (event) => {
successCallback(req.response);
if(req.status == 200) {
successCallback(req.response);
} else {
failCallback(event);
}
};
}

Expand All @@ -164,13 +168,17 @@ var ublox = (function () {
}
}

req.send(null);
try {
req.send(null);
} catch(error) {
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
console.log(i18n.getMessage("gpsAssistnowLoadDataError") + ':' + error.toString());
}
}


function loadError(event) {
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
console.log(i18n.getMessage("gpsAssistnowLoadDataError") + ':' + event.toString());
}

// For more info on assistnow, check:
Expand Down
9 changes: 8 additions & 1 deletion locale/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
"message": "日本語",
"_comment": "Don't translate!"
},
"language_zh_CN": {
"message": "简体中文",
"_comment": "Don't translate!"
},
"language": {
"message": "Language"
},
Expand Down Expand Up @@ -5704,7 +5708,7 @@
"message": "No dataflash <br>chip found"
},
"sensorDataFlashFreeSpace": {
"message": "Dataflash: free space"
"message": "Dataflash: <br />free "
},
"mixerProfile1": {
"message": "Mixer Profile 1"
Expand Down Expand Up @@ -6156,5 +6160,8 @@
},
"adsbHeartbeatTotalMessages": {
"message": "Heartbeat msgs"
},
"currentLanguage": {
"message": "en"
}
}
Loading

0 comments on commit 5f25766

Please sign in to comment.