با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
blockly > utils > parsing > placeMessageReferences
تابع utils.parsing.replaceMessageReferences().
در صورتی که پیام رشته ای باشد، جایگزین ارجاعات جدول رشته ای در پیام می شود. به عنوان مثال، "% { bky_my_msg } " و "% { BKY_MY_MSG } " هر دو با مقدار موجود در Msg ['MY_MSG'] جایگزین خواهند شد.
امضا:
export declare function replaceMessageReferences(message: string | any): string;
پارامترها
پارامتر | تایپ کنید | توضیحات |
---|
پیام | رشته | هر | پیام، که ممکن است رشته ای باشد که حاوی ارجاعات جدول رشته ای باشد. |
برمیگرداند:
رشته
رشته با ارجاع پیام جایگزین شد.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe \u003ccode\u003ereplaceMessageReferences\u003c/code\u003e function substitutes string table references within a message string with their corresponding values from the \u003ccode\u003eMsg\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eThis function handles both "%{bky_my_msg}" and "%{BKY_MY_MSG}" formats, replacing them with the value of \u003ccode\u003eMsg['MY_MSG']\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts a message, which can be a string potentially containing references or any other data type, and returns a string with references replaced.\u003c/p\u003e\n"],["\u003cp\u003eIf the input message is not a string, it is returned unchanged.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [utils](./blockly.utils_namespace.md) \\\u003e [parsing](./blockly.utils_namespace.parsing_namespace.md) \\\u003e [replaceMessageReferences](./blockly.utils_namespace.parsing_namespace.replacemessagereferences_1_function.md)\n\nutils.parsing.replaceMessageReferences() function\n-------------------------------------------------\n\nReplaces 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'\\].\n\n**Signature:** \n\n export declare function replaceMessageReferences(message: string | any): string;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|---------------|-----------------------------------------------------------------------|\n| message | string \\| any | Message, which may be a string that contains string table references. |\n\n**Returns:**\n\nstring\n\nString with message references replaced."]]