class_translation.rst 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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>` | "en" |
  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 and 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. | *Default* | "en" |
  45. +-----------+-------------------+
  46. | *Setter* | set_locale(value) |
  47. +-----------+-------------------+
  48. | *Getter* | get_locale() |
  49. +-----------+-------------------+
  50. The locale of the translation.
  51. Method Descriptions
  52. -------------------
  53. .. _class_Translation_method_add_message:
  54. - void **add_message** **(** :ref:`String<class_String>` src_message, :ref:`String<class_String>` xlated_message **)**
  55. Adds a message if nonexistent, followed by its translation.
  56. .. _class_Translation_method_erase_message:
  57. - void **erase_message** **(** :ref:`String<class_String>` src_message **)**
  58. Erases a message.
  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. .. _class_Translation_method_get_message_count:
  63. - :ref:`int<class_int>` **get_message_count** **(** **)** const
  64. Returns the number of existing messages.
  65. .. _class_Translation_method_get_message_list:
  66. - :ref:`PoolStringArray<class_PoolStringArray>` **get_message_list** **(** **)** const
  67. Returns all the messages (keys).