Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

TranslationDomainΒΆ

Inherits: RefCounted < Object

A self-contained collection of Translation resources.

DescriptionΒΆ

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.

MethodsΒΆ

void

add_translation(translation: Translation)

void

clear()

Translation

get_translation_object(locale: String) const

void

remove_translation(translation: Translation)

StringName

translate(message: StringName, context: StringName = &"") const

StringName

translate_plural(message: StringName, message_plural: StringName, n: int, context: StringName = &"") const


Method DescriptionsΒΆ

void add_translation(translation: Translation) πŸ”—

Adds a translation.


void clear() πŸ”—

Removes all translations.


Translation get_translation_object(locale: String) const πŸ”—

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


void remove_translation(translation: Translation) πŸ”—

Removes the given translation.


StringName translate(message: StringName, context: StringName = &"") const πŸ”—

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


StringName translate_plural(message: StringName, message_plural: StringName, n: int, context: StringName = &"") 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.