add generalReducer to store settings
This commit is contained in:
@@ -18,26 +18,21 @@ class BlocklyWindow extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.simpleWorkspace = React.createRef();
|
||||
var locale = window.localStorage.getItem('locale');
|
||||
this.state = {
|
||||
renderer: window.localStorage.getItem('renderer'),
|
||||
};
|
||||
if (locale === null) {
|
||||
if (navigator.language === 'de-DE') {
|
||||
locale = 'de';
|
||||
} else {
|
||||
locale = 'en';
|
||||
}
|
||||
}
|
||||
if (locale === 'de') {
|
||||
// if (locale === null) {
|
||||
// if (navigator.language === 'de-DE') {
|
||||
// locale = 'de';
|
||||
// } else {
|
||||
// locale = 'en';
|
||||
// }
|
||||
// }
|
||||
if (this.props.language === 'de') {
|
||||
Blockly.setLocale(De);
|
||||
} else if (locale === 'en') {
|
||||
} else if (this.props.language === 'en') {
|
||||
Blockly.setLocale(En);
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
const workspace = Blockly.getMainWorkspace();
|
||||
this.props.onChangeWorkspace({});
|
||||
this.props.clearStats();
|
||||
@@ -72,7 +67,7 @@ class BlocklyWindow extends Component {
|
||||
style={this.props.svg ? { height: 0 } : this.props.blocklyCSS}
|
||||
readOnly={this.props.readOnly !== undefined ? this.props.readOnly : false}
|
||||
trashcan={this.props.trashcan !== undefined ? this.props.trashcan : true}
|
||||
renderer={this.state.renderer}
|
||||
renderer={this.props.renderer}
|
||||
zoom={{ // https://developers.google.com/blockly/guides/configure/web/zoom
|
||||
controls: this.props.zoomControls !== undefined ? this.props.zoomControls : true,
|
||||
wheel: false,
|
||||
@@ -106,8 +101,14 @@ class BlocklyWindow extends Component {
|
||||
|
||||
BlocklyWindow.propTypes = {
|
||||
onChangeWorkspace: PropTypes.func.isRequired,
|
||||
clearStats: PropTypes.func.isRequired
|
||||
clearStats: PropTypes.func.isRequired,
|
||||
renderer: PropTypes.string.isRequired,
|
||||
language: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
renderer: state.general.renderer,
|
||||
language: state.general.language
|
||||
});
|
||||
|
||||
export default connect(null, { onChangeWorkspace, clearStats })(BlocklyWindow);
|
||||
export default connect(mapStateToProps, { onChangeWorkspace, clearStats })(BlocklyWindow);
|
||||
|
||||
@@ -804,7 +804,7 @@ Blockly.Msg.senseBox_mqtt_publish = "Sende an Feed/Topic";
|
||||
|
||||
/**
|
||||
* Typed Variable Modal
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -835,7 +835,7 @@ Blockly.Msg.toolbox_variables = "Variablen";
|
||||
|
||||
/**
|
||||
* Tooltips
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.tooltip_compile_code = "Code kompilieren"
|
||||
@@ -863,7 +863,7 @@ Blockly.Msg.tooltip_project_title = "Titel des Projektes"
|
||||
|
||||
/**
|
||||
* Messages
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.messages_delete_project_failed = "Fehler beim Löschen des Projektes. Versuche es noch einmal."
|
||||
@@ -895,7 +895,7 @@ Blockly.Msg.renamedialog_text = "Bitte gib einen Namen für das Projekt ein und
|
||||
|
||||
/**
|
||||
* Compile Dialog
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.compiledialog_headline = "Fehler"
|
||||
@@ -903,7 +903,7 @@ Blockly.Msg.compiledialog_text = "Beim kompilieren ist ein Fehler aufgetreten.
|
||||
|
||||
/**
|
||||
* Buttons
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.button_cancel = "Abbrechen";
|
||||
@@ -915,7 +915,7 @@ Blockly.Msg.button_back = "Zurück"
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.filename = "Dateiname";
|
||||
@@ -926,9 +926,15 @@ Blockly.Msg.projectname = "Projektname";
|
||||
*/
|
||||
Blockly.Msg.settings_head = "Einstellungen"
|
||||
Blockly.Msg.settings_language = "Sprache"
|
||||
Blockly.Msg.settings_language_text = "Auswahl der Sprache gilt für die gesamte Anwendung. Es kann zwischen Deutsch und Englisch unterschieden werden."
|
||||
Blockly.Msg.settings_language_de = "Deutsch"
|
||||
Blockly.Msg.settings_language_en = "Englisch"
|
||||
Blockly.Msg.settings_renderer_text = "Der Renderer bestimmt das aussehen der Blöcke"
|
||||
Blockly.Msg.settings_renderer = "Renderer"
|
||||
Blockly.Msg.settings_renderer_text = "Der eingestellte Renderer bestimmt das Aussehen der Blöcke. Es kann zwischen 'Geras' und 'Zelos' unterschieden werden, wobei 'Zelos' insbesondere für eine Touch-Anwendung geeignet ist."
|
||||
Blockly.Msg.settings_statistics = "Statistiken"
|
||||
Blockly.Msg.settings_statistics_text = "Die Anzeige von Statistiken zur Nutzung der Blöcke oberhalb der Arbeitsfläche kann ein- oder ausgeblendet werden."
|
||||
Blockly.Msg.settings_statistics_on = "An"
|
||||
Blockly.Msg.settings_statistics_off = "Aus"
|
||||
|
||||
/**
|
||||
* 404
|
||||
|
||||
@@ -805,7 +805,7 @@ Blockly.Msg.toolbox_variables = "Variables";
|
||||
|
||||
/**
|
||||
* Tooltips
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.tooltip_compile_code = "Compile Code"
|
||||
@@ -834,7 +834,7 @@ Blockly.Msg.renamedialog_text = "Please enter a name for the project and confirm
|
||||
|
||||
/**
|
||||
* Compile Dialog
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.compiledialog_headline = "Error"
|
||||
@@ -844,7 +844,7 @@ Blockly.Msg.compiledialog_text = "While compiling an error occured. Please check
|
||||
|
||||
/**
|
||||
* Buttons
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.button_cancel = "Cancel";
|
||||
@@ -855,12 +855,26 @@ Blockly.Msg.button_create_variableCreate = "Create Variable";
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Blockly.Msg.filename = "Filename";
|
||||
Blockly.Msg.projectname = "Projectname";
|
||||
|
||||
/**
|
||||
* Settings
|
||||
*/
|
||||
Blockly.Msg.settings_head = "Settings"
|
||||
Blockly.Msg.settings_language = "Language"
|
||||
Blockly.Msg.settings_language_text = "Selection of the language applies to the entire application. A distinction can be made between German and English."
|
||||
Blockly.Msg.settings_language_de = "German"
|
||||
Blockly.Msg.settings_language_en = "English"
|
||||
Blockly.Msg.settings_renderer = "Renderer"
|
||||
Blockly.Msg.settings_renderer_text = "The selected renderer determines the appearance of the blocks. A distinction can be made between 'Geras' and 'Zelos', whereby 'Zelos' is particularly suitable for a touch application."
|
||||
Blockly.Msg.settings_statistics = "Statistics"
|
||||
Blockly.Msg.settings_statistics_text = "The display of statistics on the usage of the blocks above the workspace can be shown or hidden."
|
||||
Blockly.Msg.settings_statistics_on = "On"
|
||||
Blockly.Msg.settings_statistics_off = "Off"
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user