Table of Contents

Class TranslationDomain

Namespace
Godot
Assembly
GodotSharp.dll

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.

public class TranslationDomain : RefCounted, IDisposable
Inheritance
TranslationDomain
Implements
Inherited Members

Constructors

TranslationDomain()

public TranslationDomain()

Properties

PseudolocalizationAccentsEnabled

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public bool PseudolocalizationAccentsEnabled { get; set; }

Property Value

bool

PseudolocalizationDoubleVowelsEnabled

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public bool PseudolocalizationDoubleVowelsEnabled { get; set; }

Property Value

bool

PseudolocalizationEnabled

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public bool PseudolocalizationEnabled { get; set; }

Property Value

bool

PseudolocalizationExpansionRatio

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public float PseudolocalizationExpansionRatio { get; set; }

Property Value

float

PseudolocalizationFakeBidiEnabled

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public bool PseudolocalizationFakeBidiEnabled { get; set; }

Property Value

bool

PseudolocalizationOverrideEnabled

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public bool PseudolocalizationOverrideEnabled { get; set; }

Property Value

bool

PseudolocalizationPrefix

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public string PseudolocalizationPrefix { get; set; }

Property Value

string

PseudolocalizationSkipPlaceholdersEnabled

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public bool PseudolocalizationSkipPlaceholdersEnabled { get; set; }

Property Value

bool

PseudolocalizationSuffix

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 NotificationTranslationChanged notification manually after you have finished modifying pseudolocalization related options.

public string PseudolocalizationSuffix { get; set; }

Property Value

string

Methods

AddTranslation(Translation)

Adds a translation.

public void AddTranslation(Translation translation)

Parameters

translation Translation

Clear()

Removes all translations.

public void Clear()

GetTranslationObject(string)

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

public Translation GetTranslationObject(string locale)

Parameters

locale string

Returns

Translation

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

Pseudolocalize(StringName)

Returns the pseudolocalized string based on the message passed in.

public StringName Pseudolocalize(StringName message)

Parameters

message StringName

Returns

StringName

RemoveTranslation(Translation)

Removes the given translation.

public void RemoveTranslation(Translation translation)

Parameters

translation Translation

Translate(StringName, StringName)

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

public StringName Translate(StringName message, StringName context = null)

Parameters

message StringName
context StringName

Returns

StringName

TranslatePlural(StringName, StringName, int, StringName)

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.

public StringName TranslatePlural(StringName message, StringName messagePlural, int n, StringName context = null)

Parameters

message StringName
messagePlural StringName
n int
context StringName

Returns

StringName