class_translation.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. 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. | void | :ref:`add_message<class_Translation_method_add_message>` **(** :ref:`StringName<class_StringName>` src_message, :ref:`StringName<class_StringName>` xlated_message **)** |
  27. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`erase_message<class_Translation_method_erase_message>` **(** :ref:`StringName<class_StringName>` src_message **)** |
  29. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`StringName<class_StringName>` | :ref:`get_message<class_Translation_method_get_message>` **(** :ref:`StringName<class_StringName>` src_message **)** const |
  31. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_message_count<class_Translation_method_get_message_count>` **(** **)** const |
  33. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_message_list<class_Translation_method_get_message_list>` **(** **)** const |
  35. +---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. Property Descriptions
  37. ---------------------
  38. .. _class_Translation_property_locale:
  39. - :ref:`String<class_String>` **locale**
  40. +-----------+-------------------+
  41. | *Default* | ``"en"`` |
  42. +-----------+-------------------+
  43. | *Setter* | set_locale(value) |
  44. +-----------+-------------------+
  45. | *Getter* | get_locale() |
  46. +-----------+-------------------+
  47. The locale of the translation.
  48. Method Descriptions
  49. -------------------
  50. .. _class_Translation_method_add_message:
  51. - void **add_message** **(** :ref:`StringName<class_StringName>` src_message, :ref:`StringName<class_StringName>` xlated_message **)**
  52. Adds a message if nonexistent, followed by its translation.
  53. ----
  54. .. _class_Translation_method_erase_message:
  55. - void **erase_message** **(** :ref:`StringName<class_StringName>` src_message **)**
  56. Erases a message.
  57. ----
  58. .. _class_Translation_method_get_message:
  59. - :ref:`StringName<class_StringName>` **get_message** **(** :ref:`StringName<class_StringName>` src_message **)** const
  60. Returns a message's translation.
  61. ----
  62. .. _class_Translation_method_get_message_count:
  63. - :ref:`int<class_int>` **get_message_count** **(** **)** const
  64. Returns the number of existing messages.
  65. ----
  66. .. _class_Translation_method_get_message_list:
  67. - :ref:`PackedStringArray<class_PackedStringArray>` **get_message_list** **(** **)** const
  68. Returns all the messages (keys).