i18n_get_drawings_data()

The i18n_get_drawings_data() function is used to get the specific data from the drawing preset.

This function can only be used after the i18n_create() function is called.

Syntax

Usage
i18n_get_drawings_data(preset_name, type, [locale], [i18n]);
Signature
function i18n_get_drawings_data(
    preset_name: string,
    type: I18N_DRAWING,             // I18N_DRAWING enum
    locale?: string,                // default = "" (use the current locale)
    i18n?: I18n | boolean           // default = false (using global i18n struct)
): number | Font | undefined

Parameters

NameTypeDefaultDescription
preset_nameStringThe name of the drawing preset to get the data from (e.g. header, body, title, etc.).
typeI18N_DRAWINGThe type of data to get from the drawing preset (e.g. I18N_DRAWING.FONT, I18N_DRAWING.SEP, etc.). See the I18N_DRAWING constant for the list of available types.
localeString""The locale code to get the drawing preset from (e.g. en, id, ja, etc.). Leave it empty to get the drawing preset from the current locale.
i18nBoolean | I18nfalseThe i18n struct reference, or leave it empty to use the global i18n struct.

Returns

Real or Font or undefined

Examples

Create Event
// assume the system is initialized on global variable
// assume you have added the "header", "body", and "button" drawing presets

// get the font from "header" drawing preset in "en" locale
var font = i18n_get_drawings_data("header", I18N_DRAWING.FONT, "en");

// get the text separation from "body" drawing preset in current locale
var sep = i18n_get_drawings_data("body", I18N_DRAWING.SEP);

// get the text width from "button" drawing preset in "id" locale
var width = i18n_get_drawings_data("button", I18N_DRAWING.WIDTH, "id");

If you pass non-existing drawing preset name in current locale, the system will check the preset name in the fallback locale. If it's still not found, it will return undefined.