Table of Contents

Class TranslationDomain

A self-contained collection of Translation resources.

Inheritance
TranslationDomain

Remarks

TranslationDomain is a self-contained collection of Translation resources. Translations can be added to or removed from it.

If you're working with the main translation domain, it is more convenient to use the wrap methods on TranslationServer.

Properties

pseudolocalization_accents_enabled

Replace all characters with their accented variants during pseudolocalization.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_accents_enabled : bool = true

Property Value

bool

Remarks

  • void set_pseudolocalization_accents_enabled(bool value)
  • bool is_pseudolocalization_accents_enabled

pseudolocalization_double_vowels_enabled

Double vowels in strings during pseudolocalization to simulate the lengthening of text due to localization.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_double_vowels_enabled : bool = false

Property Value

bool

Remarks

  • void set_pseudolocalization_double_vowels_enabled(bool value)
  • bool is_pseudolocalization_double_vowels_enabled

pseudolocalization_enabled

If true, enables pseudolocalization for the project. This can be used to spot untranslatable strings or layout issues that may occur once the project is localized to languages that have longer strings than the source language.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_enabled : bool = false

Property Value

bool

Remarks

  • void set_pseudolocalization_enabled(bool value)
  • bool is_pseudolocalization_enabled

pseudolocalization_expansion_ratio

The expansion ratio to use during pseudolocalization. A value of 0.3 is sufficient for most practical purposes, and will increase the length of each string by 30%.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_expansion_ratio : float = 0.0

Property Value

float

Remarks

  • void set_pseudolocalization_expansion_ratio(float value)
  • float get_pseudolocalization_expansion_ratio

pseudolocalization_fake_bidi_enabled

If true, emulate bidirectional (right-to-left) text when pseudolocalization is enabled. This can be used to spot issues with RTL layout and UI mirroring that will crop up if the project is localized to RTL languages such as Arabic or Hebrew.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_fake_bidi_enabled : bool = false

Property Value

bool

Remarks

  • void set_pseudolocalization_fake_bidi_enabled(bool value)
  • bool is_pseudolocalization_fake_bidi_enabled

pseudolocalization_override_enabled

Replace all characters in the string with *. Useful for finding non-localizable strings.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_override_enabled : bool = false

Property Value

bool

Remarks

  • void set_pseudolocalization_override_enabled(bool value)
  • bool is_pseudolocalization_override_enabled

pseudolocalization_prefix

Prefix that will be prepended to the pseudolocalized string.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_prefix : String = "["

Property Value

String

Remarks

  • void set_pseudolocalization_prefix(String value)
  • String get_pseudolocalization_prefix

pseudolocalization_skip_placeholders_enabled

Skip placeholders for string formatting like %s or %f during pseudolocalization. Useful to identify strings which need additional control characters to display correctly.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_skip_placeholders_enabled : bool = true

Property Value

bool

Remarks

  • void set_pseudolocalization_skip_placeholders_enabled(bool value)
  • bool is_pseudolocalization_skip_placeholders_enabled

pseudolocalization_suffix

Suffix that will be appended to the pseudolocalized string.

Note: Updating this property does not automatically update texts in the scene tree. Please propagate the NOTIFICATION_TRANSLATION_CHANGED notification manually after you have finished modifying pseudolocalization related options.

var pseudolocalization_suffix : String = "]"

Property Value

String

Remarks

  • void set_pseudolocalization_suffix(String value)
  • String get_pseudolocalization_suffix

Methods

add_translation(Translation)

Adds a translation.

void add_translation(Translation translation)

Parameters

translation Translation

clear

Removes all translations.

void clear

get_translation_object(String)

Qualifiers: const

Returns the Translation instance that best matches locale. Returns null if there are no matches.

Translation get_translation_object(String locale)

Parameters

locale String

pseudolocalize(StringName)

Qualifiers: const

Returns the pseudolocalized string based on the message passed in.

StringName pseudolocalize(StringName message)

Parameters

message StringName

remove_translation(Translation)

Removes the given translation.

void remove_translation(Translation translation)

Parameters

translation Translation

translate(StringName, StringName)

Qualifiers: const

Returns the current locale's translation for the given message and context.

StringName translate(StringName message, StringName context)

Parameters

message StringName
context StringName

translate_plural(StringName, StringName, int, StringName)

Qualifiers: const

Returns the current locale's translation for the given message, plural message and context.

The number n is the number or quantity of the plural object. It will be used to guide the translation system to fetch the correct plural form for the selected language.

StringName translate_plural(StringName message, StringName message_plural, int n, StringName context)

Parameters

message StringName
message_plural StringName
n int
context StringName