:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Translation.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Translation: Translation =========== **Inherits:** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` **Inherited By:** :ref:`PHashTranslation` Language Translation. Description ----------- Translations are resources that can be loaded and unloaded on demand. They map a string to another string. Tutorials --------- - :doc:`../tutorials/i18n/internationalizing_games` - :doc:`../tutorials/i18n/locales` Properties ---------- +-----------------------------+--------------------------------------------------+----------+ | :ref:`String` | :ref:`locale` | ``"en"`` | +-----------------------------+--------------------------------------------------+----------+ Methods ------- +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_message` **(** :ref:`StringName` src_message, :ref:`StringName` xlated_message **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`erase_message` **(** :ref:`StringName` src_message **)** | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StringName` | :ref:`get_message` **(** :ref:`StringName` src_message **)** const | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_message_count` **(** **)** const | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_message_list` **(** **)** const | +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Property Descriptions --------------------- .. _class_Translation_property_locale: - :ref:`String` **locale** +-----------+-------------------+ | *Default* | ``"en"`` | +-----------+-------------------+ | *Setter* | set_locale(value) | +-----------+-------------------+ | *Getter* | get_locale() | +-----------+-------------------+ The locale of the translation. Method Descriptions ------------------- .. _class_Translation_method_add_message: - void **add_message** **(** :ref:`StringName` src_message, :ref:`StringName` xlated_message **)** Adds a message if nonexistent, followed by its translation. ---- .. _class_Translation_method_erase_message: - void **erase_message** **(** :ref:`StringName` src_message **)** Erases a message. ---- .. _class_Translation_method_get_message: - :ref:`StringName` **get_message** **(** :ref:`StringName` src_message **)** const Returns a message's translation. ---- .. _class_Translation_method_get_message_count: - :ref:`int` **get_message_count** **(** **)** const Returns the number of existing messages. ---- .. _class_Translation_method_get_message_list: - :ref:`PackedStringArray` **get_message_list** **(** **)** const Returns all the messages (keys).