class_translationserver.rst 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. .. _class_TranslationServer_method_clear:
  45. - void **clear** **(** **)**
  46. Clears the server from all translations.
  47. .. _class_TranslationServer_method_get_loaded_locales:
  48. - :ref:`Array<class_Array>` **get_loaded_locales** **(** **)** const
  49. Returns an Array of all loaded locales of the game.
  50. .. _class_TranslationServer_method_get_locale:
  51. - :ref:`String<class_String>` **get_locale** **(** **)** const
  52. Returns the current locale of the game.
  53. .. _class_TranslationServer_method_get_locale_name:
  54. - :ref:`String<class_String>` **get_locale_name** **(** :ref:`String<class_String>` locale **)** const
  55. Returns a locale's language and its variant (e.g. ``"en_US"`` would return ``"English (United States)"``).
  56. .. _class_TranslationServer_method_remove_translation:
  57. - void **remove_translation** **(** :ref:`Translation<class_Translation>` translation **)**
  58. Removes the given translation from the server.
  59. .. _class_TranslationServer_method_set_locale:
  60. - void **set_locale** **(** :ref:`String<class_String>` locale **)**
  61. Sets the locale of the game.
  62. .. _class_TranslationServer_method_translate:
  63. - :ref:`String<class_String>` **translate** **(** :ref:`String<class_String>` message **)** const
  64. Returns the current locale's translation for the given message (key).