add translations and maxInstances

fixes #126
fixes #125
This commit is contained in:
Mario Pesch
2021-11-23 11:48:02 +01:00
parent 3c62635332
commit 56c39e9a9d
12 changed files with 534 additions and 291 deletions
+4
View File
@@ -11,6 +11,7 @@ import "./blocks/index";
import "./generator/index";
import { ZoomToFitControl } from "@blockly/zoom-to-fit";
import { initialXml } from "./initialXml.js";
import { getMaxInstances } from "./helpers/maxInstances";
class BlocklyWindow extends Component {
constructor(props) {
@@ -24,6 +25,7 @@ class BlocklyWindow extends Component {
this.props.clearStats();
workspace.addChangeListener((event) => {
this.props.onChangeWorkspace(event);
// switch on that a block is displayed disabled or not depending on whether it is correctly connected
// for SVG display, a deactivated block in the display is undesirable
if (this.props.blockDisabled) {
@@ -37,6 +39,7 @@ class BlocklyWindow extends Component {
componentDidUpdate(props) {
const workspace = Blockly.getMainWorkspace();
var xml = this.props.initialXml;
// if svg is true, then the update process is done in the BlocklySvg component
if (props.initialXml !== xml && !this.props.svg) {
@@ -69,6 +72,7 @@ class BlocklyWindow extends Component {
this.props.trashcan !== undefined ? this.props.trashcan : true
}
renderer={this.props.renderer}
maxInstances={getMaxInstances()}
zoom={{
// https://developers.google.com/blockly/guides/configure/web/zoom
controls:
@@ -0,0 +1,21 @@
/**
* To limit number of specific blocks in the workspace add block name and number of maxInstances here.
*
*/
const maxInstances = {
sensebox_wifi: 1,
sensebox_startap: 1,
sensebox_display_beginDisplay: 1,
sensebox_telegram: 1,
sensebox_telegram_do: 1,
sensebox_interval_timer: 1,
sensebox_osem_connection: 1,
sensebox_lora_initialize_otaa: 1,
sensebox_lora_initialize_abp: 1,
sensebox_phyphox_init: 1,
};
export const getMaxInstances = () => {
return maxInstances;
};
+13 -11
View File
@@ -1,10 +1,10 @@
export const FAQ = {
/**
* FAQ
*/
/**
* FAQ
*/
faq_q1_question: `Wie kann ich mein Programm auf die senseBox kopieren?`,
faq_q1_answer: `Um Programme auf die senseBox zu kopieren wird diese mit dem Micro USB Kabel an den Computer angeschlossen. Mache anschließend auf der senseBox MCU einen Doppelklick auf den roten Reset Button. Die senseBox wird nun als Wechseldatenträger an deinem Computer erkannt und die zuvor erstellen Programm können per Drag & Drop kopiert werden. Nach jeder Änderung des Programmcodes muss das Programm neu kompiliert und übertragen werden
faq_q1_question: `Wie kann ich mein Programm auf die senseBox kopieren?`,
faq_q1_answer: `Um Programme auf die senseBox zu kopieren wird diese mit dem Micro USB Kabel an den Computer angeschlossen. Mache anschließend auf der senseBox MCU einen Doppelklick auf den roten Reset Button. Die senseBox wird nun als Wechseldatenträger an deinem Computer erkannt und die zuvor erstellen Programm können per Drag & Drop kopiert werden. Nach jeder Änderung des Programmcodes muss das Programm neu kompiliert und übertragen werden
#### Lernmodus der MCU aktivieren
<iframe width="560" height="315" src="https://www.youtube.com/embed/jzlOJ7Zuqqw" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
@@ -14,14 +14,16 @@ Das Kopieren der Programme unter MacOS funktioniert nicht über den Finder, es g
- [muCommander](https://www.mucommander.com/)
`,
faq_q2_question: `Mit welcher senseBox ist die Programmierumgebung kompatibel?`,
faq_q2_answer: `
faq_q2_question: `Mit welcher senseBox ist die Programmierumgebung kompatibel?`,
faq_q2_answer: `
Grundsätzlich kann die Programmierumgebung mit jeder senseBox mit senseBox MCU verwendet werden.
`,
faq_q3_question: `Ich habe einen Fehler gefunden oder etwas funktioniert nicht. Wo kann ich diesen melden?`,
faq_q3_answer: `
faq_q3_question: `Ich habe einen Fehler gefunden oder etwas funktioniert nicht. Wo kann ich diesen melden?`,
faq_q3_answer: `
Am besten legst du dazu ein Issue auf [Github](https://github.com/sensebox/React-Ardublockly/issues) an. Alternativ kannst du uns auch eine Email an info(at)sensebox.de senden
`,
}
faq_tablet_question: `Kann ich die senseBox auch über ein Tablet programmieren?`,
faq_tablet_answer: `Ja! Installiere dazu die senseBox Connect App aus dem App Store und rufe die Learn- und Programmierumgebung in deinem Browser am Tablet auf. Genaue Informationen zur Verwendung der App findest du unter [https://sensebox.de/app](https://sensebox.de/app)`,
};
+13 -4
View File
@@ -49,7 +49,14 @@ export const UI = {
tooltip_project_title: "Titel des Projektes",
tooltip_check_solution: "Lösung kontrollieren",
tooltip_copy_code: "Code in die Zwischenablage kopieren",
tooltip_statistics_current: "Anzahl aktueller Blöcke",
tooltip_statistics_new: "Anzahl neuer Blöcke",
tooltip_statistics_changed: "Anzahl veränderter Blöcke",
tooltip_statistics_moved: "Anzahl bewegter Blöcke",
tooltip_statistics_deleted: "Anzahl gelöschter Blöcke",
tooltip_statistics_remaining: "Verbleibende Blöcke",
tooltip_statistics_show: "Statistiken anzeigen",
tooltip_start_tour: "Tour starten",
/**
* Messages
*
@@ -175,7 +182,7 @@ export const UI = {
/**
* Tutorials
*/
tutorials_home_head: "Tutorial-Übersicht",
tutorials_assessment_task: "Aufgabe",
tutorials_hardware_head: "Für die Umsetzung benötigst du folgende Hardware:",
tutorials_hardware_moreInformation:
@@ -187,7 +194,9 @@ export const UI = {
/**
* Tutorial Builder
*/
builder_createNew: "neues Tutorial erstellen",
builder_changeExisting: "bestehendes Tutorial ändern",
builder_deleteExisting: "bestehendes Tutorial löschen",
builder_solution: "Lösung",
builder_solution_submit: "Lösung einreichen",
builder_example_submit: "Beispiel einreichen",
@@ -215,7 +224,7 @@ export const UI = {
navbar_tutorials: "Tutorials",
navbar_tutorialbuilder: "Tutorial erstellen",
navbar_gallery: "Gallerie",
navbar_gallery: "Galerie",
navbar_projects: "Projekte",
navbar_menu: "Menü",
+12 -13
View File
@@ -1,11 +1,10 @@
export const FAQ = {
/**
* FAQ
*/
/**
* FAQ
*/
faq_q1_question: `How can I copy my program to the senseBox?`,
faq_q1_answer: `To copy programs to the senseBox, connect it to the computer with the Micro USB cable. Then double click on the red reset button on the senseBox MCU. The senseBox will now be recognized as a removable disk on your computer and the previously created programs can be copied via drag & drop. After each change of the program code the program must be recompiled and transferred again.
faq_q1_question: `How can I copy my program to the senseBox?`,
faq_q1_answer: `To copy programs to the senseBox, connect it to the computer with the Micro USB cable. Then double click on the red reset button on the senseBox MCU. The senseBox will now be recognized as a removable disk on your computer and the previously created programs can be copied via drag & drop. After each change of the program code the program must be recompiled and transferred again.
#### Activate learning mode of the MCU
<iframe width="560" height="315" src="https://www.youtube.com/embed/jzlOJ7Zuqqw" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
@@ -15,15 +14,15 @@ Copying programs under MacOS does not work via the Finder, but there are still t
- [muCommander](https://www.mucommander.com/)
`,
faq_q2_question: `With which senseBox is the programming environment compatible?`,
faq_q2_answer: `
faq_q2_question: `With which senseBox is the programming environment compatible?`,
faq_q2_answer: `
Basically the programming environment can be used with any senseBox with senseBox MCU.
`,
faq_q3_question: `I found an error or something is not working. Where can I report it?`,
faq_q3_answer: `
faq_q3_question: `I found an error or something is not working. Where can I report it?`,
faq_q3_answer: `
The best way to do this is to create an issue on [Github](https://github.com/sensebox/React-Ardublockly/issues). Alternatively you can send us an email to info(at)sensebox.de
`,
}
faq_tablet_question: `Can I program the senseBox with a tablet?`,
faq_tablet_answer: `Yes! Install the senseBox Connect app from the App Store and call up the learning and programming environment in your browser on the tablet. Detailed information on how to use the app can be found at [https://sensebox.de/app](https://sensebox.de/app)`,
};
+12 -2
View File
@@ -49,6 +49,14 @@ export const UI = {
tooltip_project_title: "Project title",
tooltip_check_solution: "Check solution",
tooltip_copy_code: "Copy Code to clipboard",
tooltip_statistics_current: "Number of current blocks",
tooltip_statistics_new: "Number of new blocks",
tooltip_statistics_changed: "Number of changed blocks",
tooltip_statistics_moved: "Number of moved blocks",
tooltip_statistics_deleted: "Number of deleted blocks",
tooltip_statistics_remaining: "Remaining blocks",
tooltip_statistics_show: "Show statistics",
tooltip_start_tour: "start Tour",
/**
* Messages
@@ -169,7 +177,7 @@ export const UI = {
/**
* Tutorials
*/
tutorials_home_head: "Tutorials",
tutorials_assessment_task: "Task",
tutorials_hardware_head:
"For the implementation you need the following hardware:",
@@ -182,7 +190,9 @@ export const UI = {
/**
* Tutorial Builder
*/
uilder_createNew: "create new Tutorial",
builder_changeExisting: "change existing Tutorial",
builder_deleteExisting: "remove existing Tutorial",
builder_solution: "Solution",
builder_solution_submit: "Submit Solution",
builder_example_submit: "Submit example",