added translations for toast messages

This commit is contained in:
2025-01-18 15:24:16 +01:00
parent ea325e23c5
commit 558b7354ca
9 changed files with 54 additions and 57 deletions

View File

@@ -32,7 +32,7 @@
return {...peripherals}
})
console.log("Hardware has been added to the system");
generateToast('info', 'bxs-hdd', 'Your <b>' + peripheralInfo.Name + '</b> device has been detected')
generateToast('info', 'bxs-hdd', $_("peripheralArrivalToast") + ' <b>' + peripheralInfo.Name + '</b>')
})
// Handle the event when a peripheral is removed from the system
@@ -51,7 +51,7 @@
storedPeripherals[peripheralInfo.SerialNumber].isDetected = false
return {...storedPeripherals}
})
generateToast('warning', 'bxs-hdd', 'Your <b>' + peripheralInfo.Name + '</b> device has been removed')
generateToast('warning', 'bxs-hdd', $_("peripheralRemovalToast") + ' <b>' + peripheralInfo.Name + '</b>')
})
// Set the window title
@@ -70,10 +70,10 @@
SaveProject().then((filePath) => {
needProjectSave.set(false)
console.log("Project has been saved to " + filePath)
generateToast('info', 'bxs-save', 'The project has been saved')
generateToast('info', 'bxs-save', $_("projectSavedToast"))
}).catch((error) => {
console.error(`Unable to save the project: ${error}`)
generateToast('danger', 'bx-error', 'Unable to save the project: ' + error)
generateToast('danger', 'bx-error', $_("projectSaveErrorToast") + ' ' + error)
})
}

View File

@@ -62,7 +62,7 @@
$needProjectSave = true
}).catch((error) => {
console.log("Unable to add the peripheral to the project: " + error)
generateToast('danger', 'bx-error', 'Unable to add this device to project')
generateToast('danger', 'bx-error', $_("addPeripheralErrorToast"))
})
}
@@ -86,7 +86,7 @@
$needProjectSave = true
}).catch((error) => {
console.log("Unable to remove the peripheral from the project: " + error)
generateToast('danger', 'bx-error', 'Unable to remove this device from project')
generateToast('danger', 'bx-error', $_("removePeripheralErrorToast"))
})
}
@@ -100,10 +100,10 @@
return {...currentPeriph}
})
$needProjectSave = true
generateToast('info', 'bx-signal-5', 'Your OS2L peripheral has been created')
generateToast('info', 'bx-signal-5', $_("os2lPeripheralCreatedToast"))
}).catch(error => {
console.log("Unable to add the OS2L peripheral: " + error)
generateToast('danger', 'bx-error', 'Unable to create the OS2L peripheral')
generateToast('danger', 'bx-error', $_("os2lPeripheralCreateErrorToast"))
})
}

View File

@@ -23,7 +23,7 @@
$projectsList = projects
}).catch((error) => {
console.error(`Unable to get the projects list: ${error}`)
generateToast('danger', 'bx-error', 'Unable to get the projects list')
generateToast('danger', 'bx-error', $_("projectsLoadErrorToast"))
})
}
@@ -68,10 +68,10 @@
// Load the new project peripherals
loadPeripherals(projectInfo.PeripheralsInfo)
needProjectSave.set(false)
generateToast('info', 'bx-folder-open', 'The project <b>' + projectInfo.ShowInfo.Name + '</b> was opened')
generateToast('info', 'bx-folder-open', $_("projectOpenedToast") + ' <b>' + projectInfo.ShowInfo.Name + '</b>')
}).catch((error) => {
console.error(`Unable to open the project: ${error}`)
generateToast('danger', 'bx-error', 'Unable to open the project')
generateToast('danger', 'bx-error', $_("projectOpenErrorToast"))
})
}
@@ -82,7 +82,7 @@
// Remove the saved peripherals ofthe current project
unsavePeripherals()
$needProjectSave = true
generateToast('info', 'bxs-folder-plus', 'The project was created')
generateToast('info', 'bxs-folder-plus', $_("projectCreatedToast"))
})
}
</script>

View File

@@ -34,5 +34,18 @@
"projectHardwareInputsLabel": "INPUTS",
"projectHardwareOutputsLabel": "OUTPUTS",
"projectHardwareDeleteTooltip": "Delete this peripheral",
"projectHardwareAddTooltip": "Add this peripheral to project"
"projectHardwareAddTooltip": "Add this peripheral to project",
"peripheralArrivalToast": "Peripheral inserted:",
"peripheralRemovalToast": "Peripheral removed:",
"projectSavedToast": "The project has been saved",
"projectSaveErrorToast": "Unable to save the project:",
"addPeripheralErrorToast": "Unable to add this peripheral to project",
"removePeripheralErrorToast": "Unable to remove this peripheral from project",
"os2lPeripheralCreatedToast": "Your OS2L peripheral has been created",
"os2lPeripheralCreateErrorToast": "Unable to create the OS2L peripheral",
"projectsLoadErrorToast": "Unable to get the projects list",
"projectOpenedToast": "The project was opened:",
"projectOpenErrorToast": "Unable to open the project",
"projectCreatedToast": "The project was created"
}