Skip to content

Instantly share code, notes, and snippets.

@PoppyWorks
Last active August 16, 2018 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PoppyWorks/5d9cfea80f327685dde937e756a874c0 to your computer and use it in GitHub Desktop.
Save PoppyWorks/5d9cfea80f327685dde937e756a874c0 to your computer and use it in GitHub Desktop.
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