Localization & 8-4 Scripts
Lang Files
All of DELTARUNE Chapter 1's dialogue is stored in the Chapter 1 lang folder, which is located in the same directory as where the Chapter 1 WAD file resides. The English and Japanese translations are named lang_en.json and lang_ja.json respectively.
The beginning of Chapter 1's lang_en.json is shown below:
{
"date": "1540902565549",
"DEVICE_CONTACT_slash_Step_0_gml_5_0": " ^9 ^8 %",
"DEVICE_CONTACT_slash_Step_0_gml_6_0": " ARE YOU^6& THERE^6?\\M1 ^6 %",
"DEVICE_CONTACT_slash_Step_0_gml_7_0": "^6 \\M0ARE WE^6&CONNECTED^6?\\M1 ^6 ^6 %%",
...
}
Each JSON file contains a date key whose value is a timestamp encoded in unix time. Each subsequent key is a dialogue ID (e.g. DEVICE_CONTACT_slash_Step_0_gml_5_0) with the appropriate translation as the corresponding value. The dialogue IDs are the same between the English and Japanese JSONs, making it easy for the game to find the correct text translation just from the text's dialogue ID.
Starting from Chapter 2, DELTARUNE's English dialogue no longer exists in a lang_en.json file but is instead embedded in the code of the WAD file. However, Japanese dialogue still remains in a lang_ja.json file.
8-4 Localization Scripts
The scr_84 scripts, likely named after DELTARUNE's localization company "8-4", handle DELTARUNE's localization system.
deltarune demo chapter 1 scripts
The DELTARUNE demo contains _ch1 versions of the 8-4 scripts to differentiate them from Chapter 2's scripts. Most of these scripts function exactly the same as the non-_ch1 versions, but some have small changes to be compatible with Chapter 1's code. For example, scr_84_lang_load_ch1 reads lang_en.json if the current language is English, which is not a feature in scr_84_lang_load as English dialogue is embedded in the WAD file post-Chapter 1 instead of being in an external file.
Initialization Script
DELTARUNE's initializer object, obj_initializer2, calls in its Create event the localization initialization script, scr_84_init_localization.
In essence, this script initializes some important global variables:
| Variable Name | Type | Notes |
|---|---|---|
global.lang | string |
|
global.lang_map | DS Map |
|
global.font_map | DS Map |
|
global.chemg_sprite_mapglobal.chemg_sound_map | DS Map |
|
Accessing Translation Maps
The following scripts can be used to access the global translation maps populated in the above initialization script.
| Script Name | Notes |
|---|---|
scr_84_get_font |
|
scr_84_set_draw_font |
|
scr_84_get_lang_string |
|
scr_84_get_sprite |
|
scr_84_get_sound |
|
Miscellaneous 8-4 Scripts
Listed below are some 8-4 scripts that do not have anything to do with the global translation maps.
| Script Name | Notes |
|---|---|
scr_84_get_subst_string |
|
scr_84_name_input_setup |
|
scr_84_draw_text_outline |
|
scr_84_load_ini |
|
Unused/Debug Scripts
Unused 8-4 Scripts:
scr_84_add_menu_itemscr_84_draw_menuscr_84_popscr_84_pushscr_84_is_digit
There also exists a debug script, scr_84_debug, that is used in obj_time and takes a boolean argument. However, the script is empty. It is likely that the script's contents were removed for the release version of DELTARUNE.
Changing Languages
The script used to change languages in the file select screen is scr_change_language. This script swaps global.lang from en to ja or from ja to en and then saves global.lang in true_config.ini, under the header LANG and the key LANG.
The script is_english can be used to determine if the current language is English (meaning by default !is_english() will return whether the current language is Japanese).