Rewrites calls to msgId($msgVar) to either a static constant message id or a conditional if
there is a fallback.
2981
private void handleMsgIdCall(FunctionNode fn, MsgFallbackGroupNode msgNode) {
    ExprNode msgIdNode;
    long primaryMsgId = MsgUtils.computeMsgIdForDualFormat(msgNode.getChild(0));
    if (msgNode.numChildren() == 1) {
      // easy peasy
      msgIdNode = createMsgIdNode(primaryMsgId, fn.getSourceLocation());
    } else {
      long fallbackMsgId = MsgUtils.computeMsgIdForDualFormat(msgNode.getChild(1));
      ConditionalOpNode condOpNode = new ConditionalOpNode(fn.getSourceLocation());
      FunctionNode isPrimaryMsgInUse =
          new FunctionNode(
              Identifier.create(
                  BuiltinFunction.IS_PRIMARY_MSG_IN_USE.getName(), fn.getSourceLocation()),
              BuiltinFunction.IS_PRIMARY_MSG_IN_USE,
              fn.getSourceLocation());
      // We add the varRef, and the 2 message ids to the funcitonnode as arguments so they are
      // trivial to access in the backends.  This is a little hacky however since we never generate
      // code for these things.
      // We could formalize the hack by providing a way to stash arbitrary data in the FunctionNode
      // and then just pack this up in a non-AST datastructure.
      isPrimaryMsgInUse.addChild(fn.getChild(0).copy(new CopyState()));
      isPrimaryMsgInUse.addChild(new IntegerNode(primaryMsgId, fn.getSourceLocation()));
      isPrimaryMsgInUse.addChild(new IntegerNode(fallbackMsgId, fn.getSourceLocation()));
      condOpNode.addChild(isPrimaryMsgInUse);
      condOpNode.addChild(createMsgIdNode(primaryMsgId, fn.getSourceLocation()));
      condOpNode.addChild(createMsgIdNode(fallbackMsgId, fn.getSourceLocation()));
      msgIdNode = condOpNode;
    }
    // We need to generate a record literal
    // This map literal has 2 keys: 'id' and 'msg'
    RecordLiteralNode recordLiteral =
        new RecordLiteralNode(
            Identifier.create("record", fn.getSourceLocation()),
            ImmutableList.of(
                Identifier.create("id", fn.getSourceLocation()),
                Identifier.create("msg", fn.getSourceLocation())),
            fn.getSourceLocation());
    recordLiteral.addChildren(ImmutableList.of(msgIdNode, fn.getChild(0).copy(new CopyState())));
    fn.getParent().replaceChild(fn, recordLiteral);
  }
1209616
function msg(str) {
	if (str == null) {
		return null;
	}

	for (var i = 1, len = arguments.length; i < len; ++i) {
		str = str.replace('{' + (i - 1) + '}', String(arguments[i]));
	}

	return str;
}
798981
def msg_callback(self, callback):
        """"""
        if callable(callback):
            self._msg_callback = callback
        else:
            self._msg_callback = None
1107065
public void fail(Object msgId) {
		LOG.warn("Message failed: " + msgId);
        this.pendingMessages.clear();
        this.toCommit.clear();
		synchronized(this.recoveryMutex){
		    this.hasFailures = true;
		}
	}
1310636
static function call( $server, $method, $parameters = array(), $options = array(), $return_response_obj=false )
    {
        if ( $return_response_obj )
        {
            $res = self::send(  $server, $method, $parameters, true, $options );
            if ( isset( $res['result'] ) )
                return  array( 'result' => new ggeZWebservicesResponse( $res['result'] ) );
            else
                return $res;
        }
        else
            return self::send(  $server, $method, $parameters, false, $options );
    }
401044
public void updateMessageListForHandler(String msgIds, String handlerId) {
        if (msgIds == null) {
            return; // Should never happen, but avoid NPEs
        }

        String[] msgStr = msgIds.split(",");
        ArrayList<String> newMsgList = new ArrayList<String>(Arrays.asList(msgStr));
        newMsgList.remove(""); // Ignore blank value

        // Get the list of existing handlers mapped to this message ID.
        ArrayList<String> prevMsgList = previousHandlerMessageMap.get(handlerId);
        {
            if (prevMsgList == null) {
                prevMsgList = new ArrayList<String>();
            }
        }

        if (prevMsgList.equals(newMsgList)) {
            return; // No change = nothing to do here, skip issuing message
        }

        getMessageRouter(); // Ensure router is not null

        // Check for new messages and add them to the list for the handler
        ArrayList<String> addedMsgs = new ArrayList<String>(newMsgList);
        addedMsgs.removeAll(prevMsgList);

        for (String msgId : addedMsgs) {
            msgRouter.addMsgToLogHandler(msgId, handlerId);
        }

        // Check for removed messages and remove them from the list for the handler
        ArrayList<String> removedMsgs = new ArrayList<String>(prevMsgList);
        removedMsgs.removeAll(newMsgList);

        for (String msgId : removedMsgs) {
            msgRouter.removeMsgFromLogHandler(msgId, handlerId);
        }

        // Save the new map for the next config change
        previousHandlerMessageMap.put(handlerId, newMsgList);

        // Notify that there was a change in this handler's messages
        String setOfIds = "";
        for (String msg : newMsgList) {
            if (!setOfIds.equals("")) {
                setOfIds = setOfIds.concat(" ");
            }
            setOfIds = setOfIds.concat(msg);
        }
        Tr.info(tc, "MSG_ROUTER_UPDATED", new Object[] { handlerId, setOfIds });
    }
1211760
def msgid
      begin
        if @scanner.scan(/msgid/)
          skip_whitespace
          text = message_line
          add_result(:msgid, text)
          message_multiline(:msgid) if text.empty?
          if msgid_plural
            msgstr_plural
          else
            msgstr
          end
        else
          err_msg = "Message without msgid is not allowed."
          err_msg += "The Line started unexpectedly with #{@scanner.peek(10).inspect}."
          raise PoSyntaxError, err_msg
        end
      rescue PoSyntaxError => pe
        raise PoSyntaxError, "Syntax error in msgid\n" + pe.message, pe.backtrace
      end

    end
528353
public function message_code_name($msgcode) {

        $stringman = get_string_manager();

        if ($stringman->string_exists('validationmsg_'.$msgcode, 'core_plugin')) {
            return get_string('validationmsg_'.$msgcode, 'core_plugin');
        }

        return $msgcode;
    }
206658
function (d, msgctxt, msgid, msgid_plural, n, category) {
        if (! msgid) {
            return '';
        }

        var msg_ctxt_id = msgctxt ? msgctxt + this.context_glue + msgid : msgid;

        var domainname = d || this.domain || 'messages';
        var lang = this.lang;

        // category is always LC_MESSAGES. We ignore all else
        var category_name = 'LC_MESSAGES';
        category = 5;

        var locale_data = [];
        if (typeof(this.data[lang]) != 'undefined' &&
            this.data[lang][domainname]) {
                locale_data.push(this.data[lang][domainname] );

        } else if (typeof(this.data[lang]) != 'undefined') {
            // didn't find domain we're looking for. Search all of them.
            for (var dom in this.data[lang]) {
                locale_data.push(this.data[lang][dom] );
            }
        }

        var trans = [];
        var found = false;
        var domain_used; // so we can find plural-forms if needed
        if (locale_data.length) {
            for (var i=0; i<locale_data.length; i++) {
                var locale = locale_data[i];
                if (locale.msgs[msg_ctxt_id]) {
                    var msg_ctxt_str = locale.msgs[msg_ctxt_id].msgstr;
                    trans = msg_ctxt_str.concat(trans.slice(msg_ctxt_str.length));
                    domain_used = locale;
                    found = true;
                    // only break if found translation actually has a translation.
                    if ( trans.length > 0 && trans[0].length !== 0 ) {
                        break;
                    }
                }
            }
        }

        // default to english if we lack a match, or match has zero length
        if ( trans.length === 0 || trans[0].length === 0 ) {
            trans = [ msgid, msgid_plural ];
        }

        var translation = trans[0];
        if (msgid_plural) {
            var p;
            if (found && domain_used.head.plural_func) {
                var rv = domain_used.head.plural_func(n);
                if (! rv.plural) {
                    rv.plural = 0;
                }
                if (! rv.nplural) {
                    rv.nplural = 0;
                }
                // if plurals returned is out of bound for total plural forms
                if (rv.nplural <= rv.plural) {
                    rv.plural = 0;
                }
                p = rv.plural;
            } else {
                p = (n != 1) ? 1 : 0;
            }
            if (trans[p]) {
                translation = trans[p];
            }
        }

        return translation;
    }
685178
def fatal(msg, exitcode=1, **kwargs):
    """"""
    # NOTE: Can't use normal arg named `pause` since function has same name.
    pause_before_exit = kwargs.pop("pause") if "pause" in kwargs.keys() else False
    echo("[FATAL] " + msg, **kwargs)
    if pause_before_exit:
        pause()
    sys.exit(exitcode)
279956
def on_msg(msg)

      return unless accept?(msg)

      msg = msg.dup
        # a shallow copy is sufficient

      si = if fei = msg['fei']
        Ruote::FlowExpressionId.to_storage_id(fei)
      else
        msg['wfid'] || 'no_wfid'
      end

      _id = msg['_id']
      msg['original_id'] = _id
      msg['_id'] = "#{_id}!#{si}"

      msg['type'] = 'history'
      msg['original_put_at'] = msg['put_at']

      msg.delete('_rev')

      @context.storage.put(msg)
    end
1354123
public function pgettext($msgctxt, $msgid)
    {
        $key = implode(chr(4), [$msgctxt, $msgid]);
        $ret = $this->gettext($key);
        if (strpos($ret, chr(4)) !== false) {
            return $msgid;
        }

        return $ret;
    }
1179731
private void handleNewStreamID(MessageItem msgItem) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "handleNewStreamID", new Object[] { msgItem });

    JsMessage jsMsg = msgItem.getMessage();

    handleNewStreamID(jsMsg, msgItem);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "handleNewStreamID");
  }
1095383
public function message_code_info($msgcode, $addinfo) {

        $stringman = get_string_manager();

        if ($addinfo !== null and $stringman->string_exists('validationmsg_'.$msgcode.'_info', 'core_plugin')) {
            return get_string('validationmsg_'.$msgcode.'_info', 'core_plugin', $addinfo);
        }

        return '';
    }
690077
function(_condition, _msg /*, params */) {
      if(!_condition) {
        var params = Array.prototype.slice.call(arguments, 2);
        _msg = Utils.format(_msg, params);
        $log.error(_msg); // log error message
        throw new Error(_msg);
      }
    }
1174035
function formatMessage(message, parentResult) {
    const type = (message.fatal || message.severity === 2) ? chalk.red("error") : chalk.yellow("warning");
    const msg = `${chalk.bold(message.message.replace(/([^ ])\.$/u, "$1"))}`;
    const ruleId = message.fatal ? "" : chalk.dim(`(${message.ruleId})`);
    const filePath = formatFilePath(parentResult.filePath, message.line, message.column);
    const sourceCode = parentResult.output ? parentResult.output : parentResult.source;

    const firstLine = [
        `${type}:`,
        `${msg}`,
        ruleId ? `${ruleId}` : "",
        sourceCode ? `at ${filePath}:` : `at ${filePath}`
    ].filter(String).join(" ");

    const result = [firstLine];

    if (sourceCode) {
        result.push(
            codeFrameColumns(sourceCode, { start: { line: message.line, column: message.column } }, { highlightCode: false })
        );
    }

    return result.join("\n");
}
887001
function (msg, errors, scope) {
            scope.$logError.apply(scope, [msg + ":"]);
            for (var i = 0, len = errors.length; i < len; i++) {
                scope.$logError.apply(scope, [(i + 1) + " - " + errors[i].msgId, errors[i].msgArgs]);
            }
        }