Global Variables
GM-I18n system uses several global variables to manage localization and internationalization. These variables are essential for accessing localized messages, assets, and other related functionalities.
Don't modify these variables directly. They are intended for internal use by the i18n system and may lead to unexpected behavior if modified.
i18n_name
The i18n_name
variable is a global string that holds the name of the initialized i18n system in global scope.
global.i18n_name: String
global.i18n_name = ""; // once you initialize the i18n system using `i18n_create()`, this variable will be set to the name you provided.
[i18n_name]
The [i18n_name]
variable is a global reference to the i18n system initialized with the name specified in i18n_create()
. It allows you to access the i18n system using the name directly.
global.[i18n_name]: I18n
global.i18n = i18n_create("g.i18n", "en", [ // the first parameter is the name of the i18n system
new I18nLocaleInit("en", "English", "~/langs/en.json"), // its must be same as the global variable you declared to hold the i18n system
new I18nLocaleInit("id", "Bhs Indonesia", "~/langs/id.json") // you can use "g." shorthand to refer to the global variable
]);
global.i18n_name = "i18n"; // his will be set automatically to the name of the i18n system
// example if you want to use other name
global.localization = i18n_create("global.localization", "en", [
new I18nLocaleInit("en", "English", "~/langs/en.json"),
new I18nLocaleInit("id", "Bhs Indonesia", "~/langs/id.json")
]);
global.i18n_name = "localization"; // this will be set automatically to the name of the i18n system
You don't need to understand this section in detail, except if you want to extend the i18n system or create your own custom i18n system.
Table of Contents