Kategorie: Script
/ Strings
Ab Engineversion: 8.0 OC
string_data
, the expected format is { Function="Translate", DE="Hallo, Welt", US="Hello, World"}
. If no matching entry is found or it is nil
, then another language string is returned as a fallback.nil
is passed, the parameter is returned directly. If a proplist is passed, the value corresponding to the selected language (or a fallback) is returned.Log(GetTranslatedString({ Function="Translate", DE="Dies ist ein Test.", US="This is a test."}));
local inscription = ""; // Players can read the sign via the interaction bar. public func IsInteractable() { return true; } // Called on player interaction. public func Interact(object clonk) { if (!clonk) return false; Dialogue->MessageBox(GetTranslatedString(inscription), clonk, this, clonk->GetController(), true); return true; } public func SetInscription(to_text) { inscription = to_text ?? ""; return true; } public func Definition(def) { // Inscription props if (!def.EditorProps) def.EditorProps = {}; def.EditorProps.inscription = { Name="Inscription", Type="string", Set="SetInscription", Save="Inscription", Translatable=true }; }
Translatable=true
provides a translation proplist in the correct format automatically.