Other LG Functions - Grisgram/gml-raptor GitHub Wiki

LG_init

/// @function		LG_init(locale_to_use = undefined)
/// @description	Initializes the LG system. If LG_AUTO_INIT_ON_STARTUP is set to false, 
///			it must be called at the start of the game.
///			Subsequent calls will re-initialize and reload the language file of the current language.
///			To "hot-swap" the display language, use the LG_hotswap(...) function.
/// @param {string} 	locale_to_use - If not supplied or undefined, the OS language will be used.
///			Here you can supply the locale that the user might have set in your game's options
///			from your game's settings files.

LG_add_file_async

/// @func	LG_add_file_async(_filename)
/// @desc	Loads the specified file for the default locale AND the current locale
///		and merges the strings into the string map for each locale.
///		NOTE: As the function name says, this is an async function!
///		It returns an asyncReader or undefined (if file is not found or already
///		loaded), so you may add an .on_finished(...) callback to the returned builder.
///		This function loads TWO files in parallel (default locale + current)
///		The return value is the loader of the _default_ locale, as this always exists.
///		BEST USE FOR THIS FUNCTION IS "onLoadingScreen" in the Game_Configuration script!

LG_get_stringmap

/// @function		LG_get_stringmap()
/// @description	Gets the string map of the currently active locale file.
///			This returns the entire string struct. Treat as read-only!

LG_get_fallback_stringmap

/// @function		LG_get_fallback_stringmap()
/// @description	Gets the fallback string map (the default language if a key is not found in the string map)
///			This returns the entire string struct. Treat as read-only!

LG_hotswap

/// @func	LG_hotswap(new_locale, _finished_callback = undefined, _switch_to_loading_screen = false)
/// @desc	Reload the LG system with a new language.
///		As this is an async function, you may specify a callback to be
///		invoked, when loading finished.
///		The third argument tells raptor, whether it shall move to the loading screen with the spinner
///		while reloading. Default = false, but you should set it to true, if you have very large language
///		files, which might take a second or two to load

LG_resolve

/// @function		LG_resolve(str)
/// @description	Resolve a string in the format of object instance variables.
///			These strings either start with == or =. If neither is true, str is returned unmodified.
/// @param {string} str The string to resolve
/// @returns {string}	The resolved string or str unmodified if it didn't start with at least one "="