i18n_get_message_from_ref()
The i18n_get_message_from_ref()
function is used to get the message from the reference you created using the i18n_create_ref_message()
function.
This function can only be used after the i18n_create()
function is called.
Syntax
Usage
i18n_get_message_from_ref(var_name, ref, [locale], [i18n]);
Parameters
Name | Type | Default | Description |
---|---|---|---|
var_name | String | Variable name based on the var_name parameter used in i18n_create_ref_message() function (e.g. global.my_obj.my_msg , my_obj.my_msg , my_arr.0 , my_struct.my_msg , etc.). | |
ref | String | Instance | Object | Reference name or instance id based on the ref in i18n_create_ref_message() function. Recommended to pass "global" if the reference is created in global variable, or instance id if the reference is created in an instance. | |
locale | String | "" | The locale code to get the message from. Leave it empty to get the message from the current locale. |
i18n | Boolean | I18n | false | The i18n struct reference, or leave it empty to use the global i18n struct. |
Returns
String
Examples
Create Event
// assume the system is initialized on global variable
// create some message references
msg = i18n_create_ref_message("msg", "hello");
button_text = i18n_create_ref_message("button_text", "button.text");
global.hello_text = i18n_create_ref_message("global.hello_text", "hello");
global.button_text = i18n_create_ref_message("g.button_text", "button.text");
global.gb_struct = {
text : i18n_create_ref_message("global.gb_struct.text", "hello"),
button : i18n_create_ref_message("g.gb_struct.button", "button.text"),
menu : {
about : i18n_create_ref_message("g.gb_struct.menu.about", "menu.help.about")
},
arr : [
i18n_create_ref_message("global.gb_struct.arr.0", "hello"),
i18n_create_ref_message("g.gb_struct.arr.1", "bye")
]
};
// see the function usage in the Key Pressed - Enter
Table of Contents