How to use the blockly.Msg function in blockly

To help you get started, we’ve selected a few blockly 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 miguel76 / SparqlBlocks / src / blocks / variables.js View on Github external
init: function() {
    // this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);
    this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);
    this.setColour(HUE);
    this.appendDummyInput()
        .appendField("?")
        .appendField(new Blockly.FieldVariable(), "VAR");
    this.setOutput(true, "Var");
    this.setTooltip('');
    // this.appendDummyInput()
    //     .appendField(Blockly.Msg.VARIABLES_GET_TITLE)
    //     .appendField(new Blockly.FieldVariable(
    //     Blockly.Msg.VARIABLES_GET_ITEM), 'VAR')
    //     .appendField(Blockly.Msg.VARIABLES_GET_TAIL);
    // this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP);
    // this.contextMenuMsg_ = Blockly.Msg.VARIABLES_GET_CREATE_SET;
    // this.contextMenuType_ = 'variables_set';
  }
});
github miguel76 / SparqlBlocks / src / blocks / text.js View on Github external
init: function() {
    this.setHelpUrl(Blockly.Msg.TEXT_APPEND_HELPURL);
    this.setColour(HUE);
    this.appendValueInput('TEXT')
        .appendField(Blockly.Msg.TEXT_APPEND_TO)
        .appendField(new Blockly.FieldVariable(
        Blockly.Msg.TEXT_APPEND_VARIABLE), 'VAR')
        .appendField(Blockly.Msg.TEXT_APPEND_APPENDTEXT);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    // Assign 'this' to a variable for use in the tooltip closure below.
    var thisBlock = this;
    this.setTooltip(function() {
      return Blockly.Msg.TEXT_APPEND_TOOLTIP.replace('%1',
          thisBlock.getFieldValue('VAR'));
    });
  },
  /**
github miguel76 / SparqlBlocks / src / blocks / logic.js View on Github external
['\u2260', 'NEQ'],
      ['\u200F<\u200F', 'LT'],
      ['\u200F\u2264\u200F', 'LTE'],
      ['\u200F>\u200F', 'GT'],
      ['\u200F\u2265\u200F', 'GTE']
    ];
    var ltrOperators = [
      ['=', 'EQ'],
      ['\u2260', 'NEQ'],
      ['<', 'LT'],
      ['\u2264', 'LTE'],
      ['>', 'GT'],
      ['\u2265', 'GTE']
    ];
    var OPERATORS = this.RTL ? rtlOperators : ltrOperators;
    this.setHelpUrl(Blockly.Msg.LOGIC_COMPARE_HELPURL);
    this.setColour(HUE);
    this.setOutput(true, 'BooleanExpr');
    this.appendValueInput('A');
    this.appendValueInput('B')
        .appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
    this.setInputsInline(true);
    // Assign 'this' to a variable for use in the tooltip closure below.
    var thisBlock = this;
    this.setTooltip(function() {
      var op = thisBlock.getFieldValue('OP');
      var TOOLTIPS = {
        'EQ': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,
        'NEQ': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,
        'LT': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,
        'LTE': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,
        'GT': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,
github miguel76 / SparqlBlocks / src / blocks / text.js View on Github external
init: function() {
    this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL);
    this.setColour(HUE);
    this.appendDummyInput()
        .appendField(this.newQuote_(true))
        .appendField(new Blockly.FieldTextInput(''), 'TEXT')
        .appendField(this.newQuote_(false));
    this.setOutput(true, 'LiteralString');
    this.setTooltip(Msg.TEXT_TOOLTIP);
  },
  /**
github miguel76 / SparqlBlocks / src / blocks / math.js View on Github external
init: function() {
    this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL);
    this.setColour(HUE);
    this.appendDummyInput()
        .appendField(new Blockly.FieldNumber(0), 'NUM');
    this.setOutput(true, 'LiteralNumber');
    this.setTooltip(Msg.MATH_NUMBER_TOOLTIP);
  }
});
github miguel76 / SparqlBlocks / src / blocks / math.js View on Github external
init: function() {
    var OPERATORS =
        [[Blockly.Msg.MATH_ROUND_OPERATOR_ROUND, 'ROUND'],
         [Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP, 'ROUNDUP'],
         [Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN, 'ROUNDDOWN']];
    this.setHelpUrl(Blockly.Msg.MATH_ROUND_HELPURL);
    this.setColour(HUE);
    this.setOutput(true, 'NumberExpr');
    this.appendValueInput('NUM')
        .setCheck(typeExt('NumberExpr'))
        .appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
    this.setTooltip(Blockly.Msg.MATH_ROUND_TOOLTIP);
  }
});
github miguel76 / SparqlBlocks / src / blocks / logic.js View on Github external
this.setTooltip(function() {
      var op = thisBlock.getFieldValue('OP');
      var TOOLTIPS = {
        'EQ': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,
        'NEQ': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,
        'LT': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,
        'LTE': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,
        'GT': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,
        'GTE': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE
      };
      return TOOLTIPS[op];
    });
    this.prevBlocks_ = [null, null];