class_translation.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Translation.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Translation:
  6. Translation
  7. ===========
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`PHashTranslation<class_PHashTranslation>`
  10. Language Translation.
  11. Description
  12. -----------
  13. Translations are resources that can be loaded and unloaded on demand. They map a string to another string.
  14. Tutorials
  15. ---------
  16. - :doc:`../tutorials/i18n/internationalizing_games`
  17. - :doc:`../tutorials/i18n/locales`
  18. Properties
  19. ----------
  20. +-----------------------------+--------------------------------------------------+----------+
  21. | :ref:`String<class_String>` | :ref:`locale<class_Translation_property_locale>` | ``"en"`` |
  22. +-----------------------------+--------------------------------------------------+----------+
  23. Methods
  24. -------
  25. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`_get_message<class_Translation_method__get_message>` **(** :ref:`String<class_String>` src_message **)** |virtual| |
  27. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`add_message<class_Translation_method_add_message>` **(** :ref:`String<class_String>` src_message, :ref:`String<class_String>` xlated_message **)** |
  29. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`erase_message<class_Translation_method_erase_message>` **(** :ref:`String<class_String>` src_message **)** |
  31. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`String<class_String>` | :ref:`get_message<class_Translation_method_get_message>` **(** :ref:`String<class_String>` src_message **)** |const| |
  33. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`get_message_count<class_Translation_method_get_message_count>` **(** **)** |const| |
  35. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_message_list<class_Translation_method_get_message_list>` **(** **)** |const| |
  37. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. Property Descriptions
  39. ---------------------
  40. .. _class_Translation_property_locale:
  41. - :ref:`String<class_String>` **locale**
  42. +-----------+-------------------+
  43. | *Default* | ``"en"`` |
  44. +-----------+-------------------+
  45. | *Setter* | set_locale(value) |
  46. +-----------+-------------------+
  47. | *Getter* | get_locale() |
  48. +-----------+-------------------+
  49. The locale of the translation.
  50. Method Descriptions
  51. -------------------
  52. .. _class_Translation_method__get_message:
  53. - :ref:`String<class_String>` **_get_message** **(** :ref:`String<class_String>` src_message **)** |virtual|
  54. Virtual method to override :ref:`get_message<class_Translation_method_get_message>`.
  55. ----
  56. .. _class_Translation_method_add_message:
  57. - void **add_message** **(** :ref:`String<class_String>` src_message, :ref:`String<class_String>` xlated_message **)**
  58. Adds a message if nonexistent, followed by its translation.
  59. ----
  60. .. _class_Translation_method_erase_message:
  61. - void **erase_message** **(** :ref:`String<class_String>` src_message **)**
  62. Erases a message.
  63. ----
  64. .. _class_Translation_method_get_message:
  65. - :ref:`String<class_String>` **get_message** **(** :ref:`String<class_String>` src_message **)** |const|
  66. Returns a message's translation.
  67. ----
  68. .. _class_Translation_method_get_message_count:
  69. - :ref:`int<class_int>` **get_message_count** **(** **)** |const|
  70. Returns the number of existing messages.
  71. ----
  72. .. _class_Translation_method_get_message_list:
  73. - :ref:`PoolStringArray<class_PoolStringArray>` **get_message_list** **(** **)** |const|
  74. Returns all the messages (keys).
  75. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  76. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  77. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`