Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

YarnGodotLocalisation

Yarn Spinner's localisation, built on Godot's own systems: text through TranslationServer (keys are the line ID with translation_prefix prepended), and audio through translation remaps (Project Settings > Localization > Remaps), applied by ResourceLoader. There is no separate Yarn localisation backend.
class_name YarnGodotLocalisation
extends RefCounted

Inherits from RefCounted

#Properties

#asset_locale_code

var asset_locale_code: String = ""

Type String

#audio_base_path

Folder containing the BASE-language voice files, named after the line id without its "line:" prefix (line:tutorial-tom-01 -> tutorial-tom-01.wav). Localised variants are provided by Godot translation remaps.
var audio_base_path: String = ""

Type String

#audio_extensions

var audio_extensions: PackedStringArray = [...]

Type PackedStringArray

#fallback_locale_code

var fallback_locale_code: String = ""

Type String

#fallback_to_program

var fallback_to_program: bool

Type bool

#max_audio_cache_size

var max_audio_cache_size: int = 50

Type int

#text_locale_code

var text_locale_code: String = ""

Type String

#translation_prefix

var translation_prefix: String = "YARN_"

Type String

#use_fallback

var use_fallback: bool = true

Type bool

#Signals

#locale_changed

Emitted when the locale is changed through set_current_locale.
signal locale_changed(locale: String)

Parameters

  • localeString

#Methods

#add_translation_to_server(YarnProgram, String, String)

static func add_translation_to_server(program: YarnProgram, locale: String, prefix: String = "YARN_") -> void

Parameters

#clear_audio_cache()

func clear_audio_cache() -> void

#export_as_translation(YarnProgram, String, String)

static func export_as_translation(program: YarnProgram, locale: String, prefix: String = "YARN_") -> Translation

Parameters

Returns Translation

#export_strings_for_translation(YarnProgram, String, String)

static func export_strings_for_translation(program: YarnProgram, output_path: String, prefix: String = "YARN_") -> int

Parameters

Returns int

#get_asset_locale()

func get_asset_locale() -> String

Returns String

#get_available_locales()

func get_available_locales() -> PackedStringArray

Returns PackedStringArray

#get_current_locale()

func get_current_locale() -> String

Returns String

#get_debug_info()

func get_debug_info() -> String

Returns String

#get_localised_audio(String)

func get_localised_audio(line_id: String) -> AudioStream

Parameters

  • line_idString

Returns AudioStream

#get_localised_text(String)

func get_localised_text(line_id: String) -> String

Parameters

  • line_idString

Returns String

#has_locale(String)

func has_locale(locale: String) -> bool

Parameters

  • localeString

Returns bool

#has_localised_audio(String)

func has_localised_audio(line_id: String) -> bool

Parameters

  • line_idString

Returns bool

#has_localised_text(String)

func has_localised_text(line_id: String) -> bool

Parameters

  • line_idString

Returns bool

#prepare_for_lines(PackedStringArray)

func prepare_for_lines(line_ids: PackedStringArray) -> void

Parameters

  • line_idsPackedStringArray

#set_current_locale(String)

func set_current_locale(locale: String) -> void

Parameters

  • localeString

#set_program(YarnProgram)

func set_program(program: YarnProgram) -> void

Parameters

Generated from Yarn Spinner for Godot GDScript 3.3.