'tr-rootfs-help': 'Das Root Dateisystem als separates Abbild.',
'tr-sdcard-help': 'Image für SD Speicherkarten.',
'tr-tftp-help': 'TFTP Dateien können verwendet werden, um ein Gerät über die TFTP Method des Bootloader zu flashen.',
- 'tr-other-help': 'Sonstiger Imagetyp.'
+ 'tr-other-help': 'Sonstiger Imagetyp.',
+ 'tr-build-successful': 'Build erfolgreich',
+ 'tr-build-failed': 'Build fehlgeschlagen',
+ 'tr-request-image': 'Frage nach image',
+ 'tr-check-again': 'Nochmal nachfragen in 5 Sekunden...'
},
'en': {
'tr-load': 'Download OpenWrt firmware for your device!',
'tr-rootfs-help': 'Root file system as a separate image.',
'tr-sdcard-help': 'Image that is meant to be flashed onto a SD-Card.',
'tr-tftp-help': 'TFTP images are used to flash a device via the TFTP method of the bootloader.',
- 'tr-other-help': 'Other image type.'
+ 'tr-other-help': 'Other image type.',
+ 'tr-build-successful': 'Build successful',
+ 'tr-build-failed': 'Build failed',
+ 'tr-request-image': 'Request image',
+ 'tr-check-again': 'Check again in 5 seconds...'
}
};
<img src="logo.png" alt="Logo">
<div style="flex-grow: 1;"></div>
- <select id="language-selection" onchange="applyLanguage(this.children[this.selectedIndex].value);" size="1">
+ <select id="language-selection" onchange="current_language=this.children[this.selectedIndex].value; translate();" size="1">
<option value="en">English</option>
<option value="de">Deutsch</option>
</select>
function showStatus(text) {
show('buildstatus');
$('buildstatus').innerHTML = text;
+ translate();
}
function handleError(response) {
response.json()
.then(mobj => {
- var message = mobj['message'] || 'Build Failed';
+ var message = mobj['message'] || '<span class="tr-build-failed"></span>';
if (mobj.buildlog == true) {
var url = config.asu_url + '/store/' + mobj.bin_dir + '/buildlog.txt';
showStatus('<a href="' + url + '">' + message + '</a>');
updateImages();
show('buildspinner');
- showStatus('Request image...');
+ showStatus('<span class="tr-request-image></span>');
var request_data = {
'profile': current_model.id,
switch (response.status) {
case 200:
hide('buildspinner');
- showStatus('Build successful');
+ showStatus('<span class="tr-build-successful"></span>');
response.json()
.then(mobj => {
});
break;
case 202:
- showStatus('Check again in 5 seconds...');
+ showStatus('<span class="tr-check-again"></span>');
setTimeout(_ => { build_asa_request() }, 5000);
break;
case 400: // bad request
}
// Change the translation of the entire document
-function applyLanguage(language) {
- if (language) {
- current_language = language;
- }
-
+function translate() {
var mapping = translations[current_language];
- if (mapping) {
- for (var tr in mapping) {
- Array.from(document.getElementsByClassName(tr))
+ for (var tr in mapping) {
+ Array.from(document.getElementsByClassName(tr))
.forEach(e => { e.innerText = mapping[tr]; })
- }
}
}
switchClass('downloads-title', 'tr-custom-downloads', 'tr-version-downloads');
}
// update title translation
- applyLanguage();
+ translate();
// fill out build info
$('image-model').innerText = model;
// hide fields
updateImages();
-applyLanguage(config.language);
+translate();