Stay organized with collections
Save and categorize content based on your preferences.
blockly > utils > parsing > replaceMessageReferences
utils.parsing.replaceMessageReferences() function
Replaces string table references in a message, if the message is a string. For example, "%{bky_my_msg}" and "%{BKY_MY_MSG}" will both be replaced with the value in Msg['MY_MSG'].
Signature:
export declare function replaceMessageReferences(message: string | any): string;
Parameters
Parameter |
Type |
Description |
message |
string | any |
Message, which may be a string that contains string table references. |
Returns:
string
String with message references replaced.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["The `replaceMessageReferences` function substitutes string table references within a message string with their corresponding values from the `Msg` object."],["This function handles both \"%{bky_my_msg}\" and \"%{BKY_MY_MSG}\" formats, replacing them with the value of `Msg['MY_MSG']`."],["The function accepts a message, which can be a string potentially containing references or any other data type, and returns a string with references replaced."],["If the input message is not a string, it is returned unchanged."]]],[]]