Adding translation by using i18n

This commit is contained in:
Félix Aime
2021-02-08 16:34:32 +01:00
parent b759054908
commit 8b3cc56b08
18 changed files with 456 additions and 467 deletions

View File

@ -15,58 +15,34 @@
data() {
return {
list_ssids: [],
internet: false,
iface_out:""
internet: false
}
},
methods: {
// Check if the device is connected to internet.
internet_check: function() {
axios.get(`/api/network/status`, { timeout: 10000 })
axios.get('/api/network/status', { timeout: 10000 })
.then(response => {
if (response.data.internet){
this.internet = true
}
this.load_config()
if (response.data.internet) this.internet = true
if (window.config.iface_out.charAt(0) == 'e') {
setTimeout(function () { this.goto_home(); }.bind(this), 1000);
} else {
this.get_wifi_networks();
}
})
.catch(err => (console.log(err)))
},
// Get the WiFi networks around the box.
get_wifi_networks: function() {
axios.get(`/api/network/wifi/list`, { timeout: 10000 })
axios.get('/api/network/wifi/list', { timeout: 10000 })
.then(response => {
this.list_ssids = response.data.networks
this.goto_home();
})
.catch(err => (console.log(err)))
},
// Forward the view to home, with some props
// such as (SSIDs, internet & interface)
goto_home: function() {
var list_ssids = this.list_ssids
var internet = this.internet
var iface_out = this.iface_out
router.replace({ name: 'home', params: { list_ssids: list_ssids, internet: internet, iface_out : iface_out } });
},
// Get the network_out from the config
// to determine the next steps.
load_config: function() {
axios.get(`/api/misc/config`, { timeout: 60000 })
.then(response => {
if(response.data.iface_out){
this.iface_out = response.data.iface_out
// If ethernet, just goto the homepage.
// Else, get wifi networks and then go to home.
if(this.iface_out.charAt(0) == "e"){
setTimeout(function () { this.goto_home(); }.bind(this), 1000);
} else {
this.get_wifi_networks();
}
}
})
.catch(error => {
console.log(error)
});
router.replace({ name: 'home', params: { list_ssids: list_ssids, internet: internet } });
}
},
created: function() {