Skip to content

Instantly share code, notes, and snippets.

@PoppyWorks
Last active Aug 16, 2018
Embed
What would you like to do?
GML Script. This should allow the use of any language files to be placed in an ISO639 standard named folder. The game should react accordingly based on the user's OS language. Alternatively, you can change global.language manually to test this feature.
//build fonts
//--------------------------
global.fnt_textbox = font0;
//get OS Language
//--------------------------
global.language = os_get_language();
//Load appropriate langage table for UI via JSON
//THING HERE
//List all of the dialog files in the game
//===========================
file1 = "text_engine_test_final.txt";
if !directory_exists(string(global.language)+"/")
{
alert(2,"Your OS language is not supported in the file structure.
You can add new folders and files that corrolate to the ISO639 standard.
All gylph sets may not be supported. Rollng back to English.");
global.language = "en";
if !file_exists(file1)
{
alert(3,"The script files for the language you want to use is missing: "+ string(os_get_language()));
}
}
//Add the above files to the global.script ds_map
//and check folders for the equiv language files
//===========================
global.script = ds_map_create();
global.script[? "dialog_1"] = string_insert(string(global.language)+"/",file1,0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment