class_translation.rst 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Translation.xml.
  6. .. _class_Translation:
  7. Translation
  8. ===========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`PHashTranslation<class_PHashTranslation>`
  11. Language Translation.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Translations are resources that can be loaded and unloaded on demand. They map a string to another string.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`../tutorials/i18n/internationalizing_games`
  20. - :doc:`../tutorials/i18n/locales`
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-----------------------------+--------------------------------------------------+----------+
  27. | :ref:`String<class_String>` | :ref:`locale<class_Translation_property_locale>` | ``"en"`` |
  28. +-----------------------------+--------------------------------------------------+----------+
  29. .. rst-class:: classref-reftable-group
  30. Methods
  31. -------
  32. .. table::
  33. :widths: auto
  34. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`String<class_String>` | :ref:`_get_message<class_Translation_method__get_message>` **(** :ref:`String<class_String>` src_message **)** |virtual| |
  36. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`add_message<class_Translation_method_add_message>` **(** :ref:`String<class_String>` src_message, :ref:`String<class_String>` xlated_message **)** |
  38. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`erase_message<class_Translation_method_erase_message>` **(** :ref:`String<class_String>` src_message **)** |
  40. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`String<class_String>` | :ref:`get_message<class_Translation_method_get_message>` **(** :ref:`String<class_String>` src_message **)** |const| |
  42. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`get_message_count<class_Translation_method_get_message_count>` **(** **)** |const| |
  44. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_message_list<class_Translation_method_get_message_list>` **(** **)** |const| |
  46. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. .. rst-class:: classref-section-separator
  48. ----
  49. .. rst-class:: classref-descriptions-group
  50. Property Descriptions
  51. ---------------------
  52. .. _class_Translation_property_locale:
  53. .. rst-class:: classref-property
  54. :ref:`String<class_String>` **locale** = ``"en"``
  55. .. rst-class:: classref-property-setget
  56. - void **set_locale** **(** :ref:`String<class_String>` value **)**
  57. - :ref:`String<class_String>` **get_locale** **(** **)**
  58. The locale of the translation.
  59. .. rst-class:: classref-section-separator
  60. ----
  61. .. rst-class:: classref-descriptions-group
  62. Method Descriptions
  63. -------------------
  64. .. _class_Translation_method__get_message:
  65. .. rst-class:: classref-method
  66. :ref:`String<class_String>` **_get_message** **(** :ref:`String<class_String>` src_message **)** |virtual|
  67. Virtual method to override :ref:`get_message<class_Translation_method_get_message>`.
  68. .. rst-class:: classref-item-separator
  69. ----
  70. .. _class_Translation_method_add_message:
  71. .. rst-class:: classref-method
  72. void **add_message** **(** :ref:`String<class_String>` src_message, :ref:`String<class_String>` xlated_message **)**
  73. Adds a message if nonexistent, followed by its translation.
  74. .. rst-class:: classref-item-separator
  75. ----
  76. .. _class_Translation_method_erase_message:
  77. .. rst-class:: classref-method
  78. void **erase_message** **(** :ref:`String<class_String>` src_message **)**
  79. Erases a message.
  80. .. rst-class:: classref-item-separator
  81. ----
  82. .. _class_Translation_method_get_message:
  83. .. rst-class:: classref-method
  84. :ref:`String<class_String>` **get_message** **(** :ref:`String<class_String>` src_message **)** |const|
  85. Returns a message's translation.
  86. .. rst-class:: classref-item-separator
  87. ----
  88. .. _class_Translation_method_get_message_count:
  89. .. rst-class:: classref-method
  90. :ref:`int<class_int>` **get_message_count** **(** **)** |const|
  91. Returns the number of existing messages.
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_Translation_method_get_message_list:
  95. .. rst-class:: classref-method
  96. :ref:`PoolStringArray<class_PoolStringArray>` **get_message_list** **(** **)** |const|
  97. Returns all the messages (keys).
  98. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  99. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  100. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  101. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`