class_translation.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 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. **Category:** Core
  11. Brief Description
  12. -----------------
  13. Language Translation.
  14. Properties
  15. ----------
  16. +-----------------------------+--------------------------------------------------+
  17. | :ref:`String<class_String>` | :ref:`locale<class_Translation_property_locale>` |
  18. +-----------------------------+--------------------------------------------------+
  19. Methods
  20. -------
  21. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`add_message<class_Translation_method_add_message>` **(** :ref:`String<class_String>` src_message, :ref:`String<class_String>` xlated_message **)** |
  23. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`erase_message<class_Translation_method_erase_message>` **(** :ref:`String<class_String>` src_message **)** |
  25. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`get_message<class_Translation_method_get_message>` **(** :ref:`String<class_String>` src_message **)** const |
  27. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`get_message_count<class_Translation_method_get_message_count>` **(** **)** const |
  29. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_message_list<class_Translation_method_get_message_list>` **(** **)** const |
  31. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. Description
  33. -----------
  34. Translations are resources that can be loaded/unloaded on demand. They map a string to another string.
  35. Tutorials
  36. ---------
  37. - :doc:`../tutorials/i18n/internationalizing_games`
  38. - :doc:`../tutorials/i18n/locales`
  39. Property Descriptions
  40. ---------------------
  41. .. _class_Translation_property_locale:
  42. - :ref:`String<class_String>` **locale**
  43. +----------+-------------------+
  44. | *Setter* | set_locale(value) |
  45. +----------+-------------------+
  46. | *Getter* | get_locale() |
  47. +----------+-------------------+
  48. The locale of the translation.
  49. Method Descriptions
  50. -------------------
  51. .. _class_Translation_method_add_message:
  52. - void **add_message** **(** :ref:`String<class_String>` src_message, :ref:`String<class_String>` xlated_message **)**
  53. Adds a message if nonexistent, followed by its translation.
  54. ----
  55. .. _class_Translation_method_erase_message:
  56. - void **erase_message** **(** :ref:`String<class_String>` src_message **)**
  57. Erases a message.
  58. ----
  59. .. _class_Translation_method_get_message:
  60. - :ref:`String<class_String>` **get_message** **(** :ref:`String<class_String>` src_message **)** const
  61. Returns a message's translation.
  62. ----
  63. .. _class_Translation_method_get_message_count:
  64. - :ref:`int<class_int>` **get_message_count** **(** **)** const
  65. Returns the number of existing messages.
  66. ----
  67. .. _class_Translation_method_get_message_list:
  68. - :ref:`PoolStringArray<class_PoolStringArray>` **get_message_list** **(** **)** const
  69. Returns all the messages (keys).