class_translationserver.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the TranslationServer.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_TranslationServer:
  6. TranslationServer
  7. =================
  8. **Inherits:** :ref:`Object<class_Object>`
  9. Server that manages all translations.
  10. Description
  11. -----------
  12. Server that manages all translations. Translations can be set to it and removed from it.
  13. Tutorials
  14. ---------
  15. - :doc:`../tutorials/i18n/internationalizing_games`
  16. - :doc:`../tutorials/i18n/locales`
  17. Methods
  18. -------
  19. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`add_translation<class_TranslationServer_method_add_translation>` **(** :ref:`Translation<class_Translation>` translation **)** |
  21. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`clear<class_TranslationServer_method_clear>` **(** **)** |
  23. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Array<class_Array>` | :ref:`get_loaded_locales<class_TranslationServer_method_get_loaded_locales>` **(** **)** |const| |
  25. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`get_locale<class_TranslationServer_method_get_locale>` **(** **)** |const| |
  27. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`String<class_String>` | :ref:`get_locale_name<class_TranslationServer_method_get_locale_name>` **(** :ref:`String<class_String>` locale **)** |const| |
  29. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`remove_translation<class_TranslationServer_method_remove_translation>` **(** :ref:`Translation<class_Translation>` translation **)** |
  31. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`set_locale<class_TranslationServer_method_set_locale>` **(** :ref:`String<class_String>` locale **)** |
  33. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`String<class_String>` | :ref:`translate<class_TranslationServer_method_translate>` **(** :ref:`String<class_String>` message **)** |const| |
  35. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  36. Method Descriptions
  37. -------------------
  38. .. _class_TranslationServer_method_add_translation:
  39. - void **add_translation** **(** :ref:`Translation<class_Translation>` translation **)**
  40. Adds a :ref:`Translation<class_Translation>` resource.
  41. ----
  42. .. _class_TranslationServer_method_clear:
  43. - void **clear** **(** **)**
  44. Clears the server from all translations.
  45. ----
  46. .. _class_TranslationServer_method_get_loaded_locales:
  47. - :ref:`Array<class_Array>` **get_loaded_locales** **(** **)** |const|
  48. Returns an Array of all loaded locales of the game.
  49. ----
  50. .. _class_TranslationServer_method_get_locale:
  51. - :ref:`String<class_String>` **get_locale** **(** **)** |const|
  52. Returns the current locale of the game.
  53. ----
  54. .. _class_TranslationServer_method_get_locale_name:
  55. - :ref:`String<class_String>` **get_locale_name** **(** :ref:`String<class_String>` locale **)** |const|
  56. Returns a locale's language and its variant (e.g. ``"en_US"`` would return ``"English (United States)"``).
  57. ----
  58. .. _class_TranslationServer_method_remove_translation:
  59. - void **remove_translation** **(** :ref:`Translation<class_Translation>` translation **)**
  60. Removes the given translation from the server.
  61. ----
  62. .. _class_TranslationServer_method_set_locale:
  63. - void **set_locale** **(** :ref:`String<class_String>` locale **)**
  64. Sets the locale of the game.
  65. ----
  66. .. _class_TranslationServer_method_translate:
  67. - :ref:`String<class_String>` **translate** **(** :ref:`String<class_String>` message **)** |const|
  68. Returns the current locale's translation for the given message (key).
  69. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  70. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  71. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`