i18n_draw_message()
The i18n_draw_message() function is used to draw a localized text. It's a wrapper for the draw_text_* functions with convenient additional features, so you can use it just like the draw_text_* functions.
This function can only be used after the i18n_create() function is called.
Syntax
Usage
i18n_draw_message(x, y, text, [data], [preset_name], [locale], [i18n]);
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| x | Real | The x position to draw the text (e.g. room_width / 2). | |
| y | Real | The y position to draw the text (e.g. room_height / 2). | |
| text | String | The text to draw. You can pass a normal text, or a message key (start with @:) to draw a translated text (e.g. "Hello World!", my_text, or "@:hello"). | |
| data | Integer | Any[] | undefined | The data to pass to the message pluralization (Integer) or indexed interpolation (Any[]). |
| preset_name | String | "" | The name of the drawing preset to use (e.g. "header", "body", "title", etc.). Leave it empty to mark it as dynamic preset. |
| locale | String | "" | The locale code to use the drawing preset (and message key if the text parameter is a message key). Leave it empty if you don't want to use any drawing preset, or you want the message key to be static. |
| i18n | Boolean | I18n | false | The I18n struct reference, or leave it empty to use the global i18n struct. |
Returns
Void
Examples
Create Event
// pluralization
plural_index = 1;
// indexed interpolation
player_name = "John";
intp_data = ["GM-I18n", player_name];
apple = {
cost : 999999,
resc : "copper coins"
};
// add some drawing presets
i18n_add_drawings(["en", "id"], ["title", "header", "body"], [
new I18nDrawings(fnNotoSans, fa_center, fa_middle, #FFFFFF, 1.2, 0, 1),
new I18nDrawings(fnNotoSans, fa_left, fa_middle, #FFFFFF, 1, 0, 1),
new I18nDrawings(fnNotoSans, fa_left, fa_top, #CCCCCC, 0.8, 0, 1, -1, 700)
]);
For the detailed example of this function, you can see the Drawing section.
Table of Contents