How to use the @iobroker/adapter-react/i18n.getLanguage function in @iobroker/adapter-react

To help you get started, we’ve selected a few @iobroker/adapter-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ioBroker / ioBroker.javascript / src / src / Components / BlocklyEditor.js View on Github external
getToolbox() {
        // Interpolate translated messages into toolbox.
        let toolboxText = window.document.getElementById('toolbox').outerHTML;
        toolboxText = toolboxText.replace(/{(\w+)}/g, (m, p1) => window.MSG[p1]);

        let blocks = '';
        const lang = I18n.getLanguage();
        for (let cb = 0; cb < this.Blockly.CustomBlocks.length; cb++) {
            const name = this.Blockly.CustomBlocks[cb];
            // add blocks
            blocks += '';
            for (const _b in this.Blockly[name].blocks) {
                if (this.Blockly[name].blocks.hasOwnProperty(_b)) {
                    blocks += this.Blockly[name].blocks[_b];
                }
            }
            blocks += '';
        }
        toolboxText = toolboxText.replace('%%CUSTOM_BLOCKS%%', blocks);
        return toolboxText;
    }
github ioBroker / ioBroker.iot / src / src / Tabs / Enums.js View on Github external
onEdit(id) {
        const obj = this.state.funcs.find(e => e._id === id) || this.state.rooms.find(e => e._id === id);
        let smartName = Utils.getSmartNameFromObj(obj, this.props.adapterName + '.' + this.props.instance, this.props.native.noCommon);
        if (typeof smartName === 'object' && smartName) {
            smartName = smartName[I18n.getLanguage()] || smartName.en;
        }
        smartName = smartName || Utils.getObjectNameFromObj(obj, null, {language: I18n.getLanguage()});
        this.setState({editId: id, editedSmartName: smartName});
    }
github ioBroker / ioBroker.iot / src / src / Tabs / GoogleSmartNames.js View on Github external
.then(obj => {
                    let smartName = device.common.smartName  ?  device.common.smartName  : device._id;
                    if (typeof smartName === 'object' && smartName) {
                        smartName = smartName[I18n.getLanguage()] || smartName.en;
                    }
                    this.editedSmartName = smartName;
                    this.setState({editId: id, editedSmartName: smartName, editObjectName: Utils.getObjectNameFromObj(obj, null, {language: I18n.getLanguage()})});
                });
            return true;
github ioBroker / ioBroker.iot / src / src / Tabs / AlexaSmartNames.js View on Github external
.then(obj => {
                    let smartName = device.additionalApplianceDetails.friendlyNames ? device.additionalApplianceDetails.friendlyNames : device.friendlyName;
                    if (typeof smartName === 'object' && smartName) {
                        smartName = smartName[I18n.getLanguage()] || smartName.en;
                    }
                    this.editedSmartName = smartName;
                    let editedSmartType = null;
                    if (!device.additionalApplianceDetails.group) {
                        editedSmartType = device.additionalApplianceDetails.smartType;
                    }

                    this.setState({editId: id, editedSmartType, editedSmartName: smartName, editObjectName: Utils.getObjectNameFromObj(obj, null, {language: I18n.getLanguage()})});
                });
            return true;
github ioBroker / ioBroker.javascript / src / src / Dialogs / Cron.js View on Github external
key="simple"
                            checked={this.state.mode === 'simple'}
                            onChange={e => this.setMode('simple')}
                        /&gt;<label> this.setMode('simple')}
                                 style={this.state.mode !== 'simple' ? {color: 'lightgrey'} : {}}&gt;{I18n.t('sc_simple')}</label>
                         this.setMode('complex')}
                        /&gt;<label> this.setMode('complex')} style={this.state.mode !== 'complex' ? {color: 'lightgrey'} : {}}&gt;{I18n.t('sc_cron')}</label>)}

                    {this.state.mode === 'simple' &amp;&amp;
                        ( this.setState({cron})}
                            language={I18n.getLanguage()}
                        /&gt;)}
                    {this.state.mode === 'wizard' &amp;&amp;
                        ( this.setState({cron})}
                            language={I18n.getLanguage()}
                        /&gt;)}
                    {this.state.mode === 'complex' &amp;&amp;
                        ( this.setState({cron})}
                            language={I18n.getLanguage()}
                        /&gt;)}
                
                
                    <button> this.handleOk()}     color="primary"&gt;{this.props.ok || I18n.t('Ok')}</button>