os_get_region

This function returns a different value depending on the browser or device language region.

Syntax:

GML Code Example

os_get_region()


Returns: String


Description

This function returns a string with the two or three letter Regional Code for the OS that is running the game, as set by the ISO3166-1 standard. If the information is not available, it will hold simply an empty string "".

NOTE: This is not the location regional code that is returned, but the regional language code of the OS.


Example:

GML Code Example

switch (os_get_language())
    {
    case "zh":
       var region = os_get_region();
       if (region == "hk" || region == "mo" || region == "tw")
          {
          ini_open("chinese_traditional.ini");
          }
       else
          {
          ini_open("chinese_simplified.ini");
          }
    break;
    case "fr":
       ini_open("french.ini");
    break;
    case "it":
       ini_open("italian.ini");
    break;
    default:
       ini_open("english.ini");
    break;
    }
 

The above code checks the OS language and if it is Chinese, it then checks the OS region, opening a different *.ini file depending on the returned values.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here