code: function updateLanguage() {
    var rootBlock = getRootBlock();
    if (!rootBlock) {
      return;
    }
    var blockType = rootBlock.getFieldValue('NAME').trim().toLowerCase();
    if (!blockType) {
      blockType = UNNAMED;
    }
    blockType = blockType.replace(/\W/g, '_').replace(/^(\d)/, '_\\1');
    switch (document.getElementById('format').value) {
      case 'JSON':
        var code = formatJson_(blockType, rootBlock);
        break;
      case 'JavaScript':
        var code = formatJavaScript_(blockType, rootBlock);
        break;
    }
    injectCode(code, 'languagePre');
    updatePreview();
  }
docs: Update the language code based on constructs made in Blockly.