pandemonium_engine_docs/classes/class_translationserver.rst

202 lines
12 KiB
ReStructuredText
Raw Normal View History

: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<class_Object>`
Server that manages all translations.
Description
-----------
Server that manages all translations. Translations can be set to it and removed from it.
Tutorials
---------
- :doc:`../tutorials/i18n/internationalizing_games`
- :doc:`../tutorials/i18n/locales`
Methods
-------
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_translation<class_TranslationServer_method_add_translation>` **(** :ref:`Translation<class_Translation>` translation **)** |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear<class_TranslationServer_method_clear>` **(** **)** |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`compare_locales<class_TranslationServer_method_compare_locales>` **(** :ref:`String<class_String>` locale_a, :ref:`String<class_String>` locale_b **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_all_countries<class_TranslationServer_method_get_all_countries>` **(** **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_all_languages<class_TranslationServer_method_get_all_languages>` **(** **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_all_scripts<class_TranslationServer_method_get_all_scripts>` **(** **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_country_name<class_TranslationServer_method_get_country_name>` **(** :ref:`String<class_String>` country **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_language_name<class_TranslationServer_method_get_language_name>` **(** :ref:`String<class_String>` language **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_loaded_locales<class_TranslationServer_method_get_loaded_locales>` **(** **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_locale<class_TranslationServer_method_get_locale>` **(** **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_locale_name<class_TranslationServer_method_get_locale_name>` **(** :ref:`String<class_String>` locale **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_script_name<class_TranslationServer_method_get_script_name>` **(** :ref:`String<class_String>` script **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`remove_translation<class_TranslationServer_method_remove_translation>` **(** :ref:`Translation<class_Translation>` translation **)** |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_locale<class_TranslationServer_method_set_locale>` **(** :ref:`String<class_String>` locale **)** |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`standardize_locale<class_TranslationServer_method_standardize_locale>` **(** :ref:`String<class_String>` locale **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`translate<class_TranslationServer_method_translate>` **(** :ref:`String<class_String>` message **)** |const| |
+-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Method Descriptions
-------------------
.. _class_TranslationServer_method_add_translation:
- void **add_translation** **(** :ref:`Translation<class_Translation>` translation **)**
Adds a :ref:`Translation<class_Translation>` resource.
----
.. _class_TranslationServer_method_clear:
- void **clear** **(** **)**
Clears the server from all translations.
----
.. _class_TranslationServer_method_compare_locales:
- :ref:`int<class_int>` **compare_locales** **(** :ref:`String<class_String>` locale_a, :ref:`String<class_String>` locale_b **)** |const|
Compares two locales and return similarity score between ``0``\ (no match) and ``10``\ (full match).
----
.. _class_TranslationServer_method_get_all_countries:
- :ref:`PoolStringArray<class_PoolStringArray>` **get_all_countries** **(** **)** |const|
Returns array of known country codes.
----
.. _class_TranslationServer_method_get_all_languages:
- :ref:`PoolStringArray<class_PoolStringArray>` **get_all_languages** **(** **)** |const|
Returns array of known language codes.
----
.. _class_TranslationServer_method_get_all_scripts:
- :ref:`PoolStringArray<class_PoolStringArray>` **get_all_scripts** **(** **)** |const|
Returns array of known script codes.
----
.. _class_TranslationServer_method_get_country_name:
- :ref:`String<class_String>` **get_country_name** **(** :ref:`String<class_String>` country **)** |const|
Returns readable country name for the ``country`` code.
----
.. _class_TranslationServer_method_get_language_name:
- :ref:`String<class_String>` **get_language_name** **(** :ref:`String<class_String>` language **)** |const|
Returns readable language name for the ``language`` code.
----
.. _class_TranslationServer_method_get_loaded_locales:
- :ref:`Array<class_Array>` **get_loaded_locales** **(** **)** |const|
Returns an array of all loaded locales of the project.
----
.. _class_TranslationServer_method_get_locale:
- :ref:`String<class_String>` **get_locale** **(** **)** |const|
Returns the current locale of the project.
See also :ref:`OS.get_locale<class_OS_method_get_locale>` and :ref:`OS.get_locale_language<class_OS_method_get_locale_language>` to query the locale of the user system.
----
.. _class_TranslationServer_method_get_locale_name:
- :ref:`String<class_String>` **get_locale_name** **(** :ref:`String<class_String>` locale **)** |const|
Returns a locale's language and its variant (e.g. ``"en_US"`` would return ``"English (United States)"``).
----
.. _class_TranslationServer_method_get_script_name:
- :ref:`String<class_String>` **get_script_name** **(** :ref:`String<class_String>` script **)** |const|
Returns readable script name for the ``script`` code.
----
.. _class_TranslationServer_method_remove_translation:
- void **remove_translation** **(** :ref:`Translation<class_Translation>` translation **)**
Removes the given translation from the server.
----
.. _class_TranslationServer_method_set_locale:
- void **set_locale** **(** :ref:`String<class_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.
----
.. _class_TranslationServer_method_standardize_locale:
- :ref:`String<class_String>` **standardize_locale** **(** :ref:`String<class_String>` locale **)** |const|
Retunrs ``locale`` string standardized to match known locales (e.g. ``en-US`` would be matched to ``en_US``).
----
.. _class_TranslationServer_method_translate:
- :ref:`String<class_String>` **translate** **(** :ref:`String<class_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.)`