:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/TranslationServer.xml. .. _class_TranslationServer: TranslationServer ================= **Inherits:** :ref:`Object` Server that manages all translations. .. rst-class:: classref-introduction-group Description ----------- Server that manages all translations. Translations can be set to it and removed from it. .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`../tutorials/i18n/internationalizing_games` - :doc:`../tutorials/i18n/locales` .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_translation` **(** :ref:`Translation` translation **)** | +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_loaded_locales` **(** **)** |const| | +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_locale` **(** **)** |const| | +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_locale_name` **(** :ref:`String` locale **)** |const| | +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_translation` **(** :ref:`Translation` translation **)** | +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_locale` **(** :ref:`String` locale **)** | +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`translate` **(** :ref:`String` message **)** |const| | +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_TranslationServer_method_add_translation: .. rst-class:: classref-method void **add_translation** **(** :ref:`Translation` translation **)** Adds a :ref:`Translation` resource. .. rst-class:: classref-item-separator ---- .. _class_TranslationServer_method_clear: .. rst-class:: classref-method void **clear** **(** **)** Clears the server from all translations. .. rst-class:: classref-item-separator ---- .. _class_TranslationServer_method_get_loaded_locales: .. rst-class:: classref-method :ref:`Array` **get_loaded_locales** **(** **)** |const| Returns an array of all loaded locales of the project. .. rst-class:: classref-item-separator ---- .. _class_TranslationServer_method_get_locale: .. rst-class:: classref-method :ref:`String` **get_locale** **(** **)** |const| Returns the current locale of the project. See also :ref:`OS.get_locale` and :ref:`OS.get_locale_language` to query the locale of the user system. .. rst-class:: classref-item-separator ---- .. _class_TranslationServer_method_get_locale_name: .. rst-class:: classref-method :ref:`String` **get_locale_name** **(** :ref:`String` locale **)** |const| Returns a locale's language and its variant (e.g. ``"en_US"`` would return ``"English (United States)"``). .. rst-class:: classref-item-separator ---- .. _class_TranslationServer_method_remove_translation: .. rst-class:: classref-method void **remove_translation** **(** :ref:`Translation` translation **)** Removes the given translation from the server. .. rst-class:: classref-item-separator ---- .. _class_TranslationServer_method_set_locale: .. rst-class:: classref-method void **set_locale** **(** :ref:`String` locale **)** Sets the locale of the project. The ``locale`` string will be standardized to match known locales (e.g. ``en-US`` would be matched to ``en_US``). If translations have been loaded beforehand for the new locale, they will be applied. .. rst-class:: classref-item-separator ---- .. _class_TranslationServer_method_translate: .. rst-class:: classref-method :ref:`String` **translate** **(** :ref:`String` message **)** |const| Returns the current locale's translation for the given message (key). .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`