Skip to reading
Game Translations

17. Change language from scripts and visual scripting

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView PDF page
On this page

The same language actions are available through the shared action system. Use the normal action node or action-list entry in visual scripting, then set its language fields just as in the GUI event example.

For scripts, keep the entry function supplied by the editor. The following snippets show the relevant calls; you do not need all four language versions in one project.

GDScript#

Code example
await SetGameLanguage({
    "language": "fr", "persist": true
})
await ChangeVoiceLanguage({"language": "en"})
await ChangeSubtitleLanguage({"language": "fr"})

This requests French game text, English speech and French movie subtitle cues. Set persist to

false when trying a temporary game-language change.

To refresh the example GUI sign after selecting the language:

Code example
await ChangeGUIElementProperty({
    "guiId": "translation_hud",
    "elementId": "workshop_sign",
    "property": "assetId",
    "value": "sign_en"
})

The source asset ID stays the same. Its language mapping decides which file is loaded when the element rebuilds.

PCA Script#

Code example
function run()
    SetGameLanguage({"language": "fr", "persist": true})
    ChangeVoiceLanguage({"language": "auto"})
end
Page 41 of 50Permalink
Go to page