class_translationserver.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/TranslationServer.xml.
  6. .. _class_TranslationServer:
  7. TranslationServer
  8. =================
  9. **Inherits:** :ref:`Object<class_Object>`
  10. Server that manages all translations.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Server that manages all translations. Translations can be set to it and removed from it.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`../tutorials/i18n/internationalizing_games`
  19. - :doc:`../tutorials/i18n/locales`
  20. .. rst-class:: classref-reftable-group
  21. Methods
  22. -------
  23. .. table::
  24. :widths: auto
  25. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`add_translation<class_TranslationServer_method_add_translation>` **(** :ref:`Translation<class_Translation>` translation **)** |
  27. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`clear<class_TranslationServer_method_clear>` **(** **)** |
  29. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Array<class_Array>` | :ref:`get_loaded_locales<class_TranslationServer_method_get_loaded_locales>` **(** **)** |const| |
  31. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`String<class_String>` | :ref:`get_locale<class_TranslationServer_method_get_locale>` **(** **)** |const| |
  33. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`String<class_String>` | :ref:`get_locale_name<class_TranslationServer_method_get_locale_name>` **(** :ref:`String<class_String>` locale **)** |const| |
  35. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`remove_translation<class_TranslationServer_method_remove_translation>` **(** :ref:`Translation<class_Translation>` translation **)** |
  37. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`set_locale<class_TranslationServer_method_set_locale>` **(** :ref:`String<class_String>` locale **)** |
  39. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`String<class_String>` | :ref:`translate<class_TranslationServer_method_translate>` **(** :ref:`String<class_String>` message **)** |const| |
  41. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  42. .. rst-class:: classref-section-separator
  43. ----
  44. .. rst-class:: classref-descriptions-group
  45. Method Descriptions
  46. -------------------
  47. .. _class_TranslationServer_method_add_translation:
  48. .. rst-class:: classref-method
  49. void **add_translation** **(** :ref:`Translation<class_Translation>` translation **)**
  50. Adds a :ref:`Translation<class_Translation>` resource.
  51. .. rst-class:: classref-item-separator
  52. ----
  53. .. _class_TranslationServer_method_clear:
  54. .. rst-class:: classref-method
  55. void **clear** **(** **)**
  56. Clears the server from all translations.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_TranslationServer_method_get_loaded_locales:
  60. .. rst-class:: classref-method
  61. :ref:`Array<class_Array>` **get_loaded_locales** **(** **)** |const|
  62. Returns an array of all loaded locales of the project.
  63. .. rst-class:: classref-item-separator
  64. ----
  65. .. _class_TranslationServer_method_get_locale:
  66. .. rst-class:: classref-method
  67. :ref:`String<class_String>` **get_locale** **(** **)** |const|
  68. Returns the current locale of the project.
  69. 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.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_TranslationServer_method_get_locale_name:
  73. .. rst-class:: classref-method
  74. :ref:`String<class_String>` **get_locale_name** **(** :ref:`String<class_String>` locale **)** |const|
  75. Returns a locale's language and its variant (e.g. ``"en_US"`` would return ``"English (United States)"``).
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_TranslationServer_method_remove_translation:
  79. .. rst-class:: classref-method
  80. void **remove_translation** **(** :ref:`Translation<class_Translation>` translation **)**
  81. Removes the given translation from the server.
  82. .. rst-class:: classref-item-separator
  83. ----
  84. .. _class_TranslationServer_method_set_locale:
  85. .. rst-class:: classref-method
  86. void **set_locale** **(** :ref:`String<class_String>` locale **)**
  87. 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``).
  88. If translations have been loaded beforehand for the new locale, they will be applied.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_TranslationServer_method_translate:
  92. .. rst-class:: classref-method
  93. :ref:`String<class_String>` **translate** **(** :ref:`String<class_String>` message **)** |const|
  94. Returns the current locale's translation for the given message (key).
  95. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  96. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  97. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  98. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`