class_translationserver.rst 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Server that manages all translations.
  13. Methods
  14. -------
  15. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`add_translation<class_TranslationServer_method_add_translation>` **(** :ref:`Translation<class_Translation>` translation **)** |
  17. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`clear<class_TranslationServer_method_clear>` **(** **)** |
  19. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`Array<class_Array>` | :ref:`get_loaded_locales<class_TranslationServer_method_get_loaded_locales>` **(** **)** const |
  21. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`String<class_String>` | :ref:`get_locale<class_TranslationServer_method_get_locale>` **(** **)** const |
  23. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`String<class_String>` | :ref:`get_locale_name<class_TranslationServer_method_get_locale_name>` **(** :ref:`String<class_String>` locale **)** const |
  25. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`remove_translation<class_TranslationServer_method_remove_translation>` **(** :ref:`Translation<class_Translation>` translation **)** |
  27. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`set_locale<class_TranslationServer_method_set_locale>` **(** :ref:`String<class_String>` locale **)** |
  29. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`String<class_String>` | :ref:`translate<class_TranslationServer_method_translate>` **(** :ref:`String<class_String>` message **)** const |
  31. +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  32. Description
  33. -----------
  34. Server that manages all translations. Translations can be set to it and removed from it.
  35. Tutorials
  36. ---------
  37. - :doc:`../tutorials/i18n/internationalizing_games`
  38. - :doc:`../tutorials/i18n/locales`
  39. Method Descriptions
  40. -------------------
  41. .. _class_TranslationServer_method_add_translation:
  42. - void **add_translation** **(** :ref:`Translation<class_Translation>` translation **)**
  43. Adds a :ref:`Translation<class_Translation>` resource.
  44. ----
  45. .. _class_TranslationServer_method_clear:
  46. - void **clear** **(** **)**
  47. Clears the server from all translations.
  48. ----
  49. .. _class_TranslationServer_method_get_loaded_locales:
  50. - :ref:`Array<class_Array>` **get_loaded_locales** **(** **)** const
  51. ----
  52. .. _class_TranslationServer_method_get_locale:
  53. - :ref:`String<class_String>` **get_locale** **(** **)** const
  54. Returns the current locale of the game.
  55. ----
  56. .. _class_TranslationServer_method_get_locale_name:
  57. - :ref:`String<class_String>` **get_locale_name** **(** :ref:`String<class_String>` locale **)** const
  58. Returns a locale's language and its variant (e.g. "en_US" would return "English (United States)").
  59. ----
  60. .. _class_TranslationServer_method_remove_translation:
  61. - void **remove_translation** **(** :ref:`Translation<class_Translation>` translation **)**
  62. Removes the given translation from the server.
  63. ----
  64. .. _class_TranslationServer_method_set_locale:
  65. - void **set_locale** **(** :ref:`String<class_String>` locale **)**
  66. Sets the locale of the game.
  67. ----
  68. .. _class_TranslationServer_method_translate:
  69. - :ref:`String<class_String>` **translate** **(** :ref:`String<class_String>` message **)** const
  70. Returns the current locale's translation for the given message (key).