UserFacingMessage
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Cung cấp một thông báo dành cho người dùng kèm theo thông tin về ngôn ngữ. Thông báo có độ dài tối đa là 4.096 ký tự.
Biểu diễn dưới dạng JSON |
{
"localizedMessages": {
string: string,
...
},
"defaultMessage": string
} |
Trường |
localizedMessages |
map (key: string, value: string)
Bản đồ chứa <locale, thông báo> các cặp, trong đó ngôn ngữ là mã ngôn ngữ BCP 47 được định dạng đúng, chẳng hạn như en-US, es-ES hoặc fr. Một đối tượng chứa danh sách các cặp "key": value . Ví dụ: { "name": "wrench", "mass": "1.3kg", "count": "3" } .
|
defaultMessage |
string
Thông báo mặc định sẽ xuất hiện nếu không có thông báo đã bản địa hoá nào được chỉ định hoặc ngôn ngữ của người dùng không khớp với bất kỳ thông báo đã bản địa hoá nào. Bạn phải cung cấp một thông báo mặc định nếu có bất kỳ thông báo đã bản địa hoá nào.
|
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eThe JSON representation is used to provide user-facing messages with locale information, with a maximum length of 4096 characters.\u003c/p\u003e\n"],["\u003cp\u003eIt includes \u003ccode\u003elocalizedMessages\u003c/code\u003e, a map of locale codes and corresponding messages, and \u003ccode\u003edefaultMessage\u003c/code\u003e for fallback display.\u003c/p\u003e\n"],["\u003cp\u003eA well-formed BCP 47 language code is used for locale specification, and a default message is required if localized messages are provided.\u003c/p\u003e\n"]]],["The content defines a JSON structure for user-facing messages with locale support. It includes `localizedMessages`, a map where keys are BCP 47 language codes and values are translated messages. The `defaultMessage` field is a string providing a fallback message when no matching locale is found. `localizedMessages` holds key-value message pairs, and a default message is required if there are any localized ones. The maximum message length is 4096 characters.\n"],null,["- [JSON representation](#SCHEMA_REPRESENTATION)\n\nProvides a user-facing message with locale info. The maximum message length is 4096 characters.\n\n| JSON representation |\n|------------------------------------------------------------------------------------|\n| ``` { \"localizedMessages\": { string: string, ... }, \"defaultMessage\": string } ``` |\n\n| Fields ||\n|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `localizedMessages` | `map (key: string, value: string)` A map containing \\\u003clocale, message\\\u003e pairs, where locale is a well-formed [BCP 47 language](https://www.w3.org/International/articles/language-tags/) code, such as en-US, es-ES, or fr. An object containing a list of `\"key\": value` pairs. Example: `{ \"name\": \"wrench\", \"mass\": \"1.3kg\", \"count\": \"3\" }`. |\n| `defaultMessage` | `string` The default message displayed if no localized message is specified or the user's locale doesn't match with any of the localized messages. A default message must be provided if any localized messages are provided. |"]]