TranslationServer.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TranslationServer" inherits="Object" version="4.0">
  3. <brief_description>
  4. Server that manages all translations.
  5. </brief_description>
  6. <description>
  7. Server that manages all translations. Translations can be set to it and removed from it.
  8. </description>
  9. <tutorials>
  10. <link title="Internationalizing games">https://docs.godotengine.org/en/latest/tutorials/i18n/internationalizing_games.html</link>
  11. <link title="Locales">https://docs.godotengine.org/en/latest/tutorials/i18n/locales.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="add_translation">
  15. <return type="void" />
  16. <argument index="0" name="translation" type="Translation" />
  17. <description>
  18. Adds a [Translation] resource.
  19. </description>
  20. </method>
  21. <method name="clear">
  22. <return type="void" />
  23. <description>
  24. Clears the server from all translations.
  25. </description>
  26. </method>
  27. <method name="get_loaded_locales" qualifiers="const">
  28. <return type="Array" />
  29. <description>
  30. Returns an array of all loaded locales of the project.
  31. </description>
  32. </method>
  33. <method name="get_locale" qualifiers="const">
  34. <return type="String" />
  35. <description>
  36. Returns the current locale of the project.
  37. See also [method OS.get_locale] and [method OS.get_locale_language] to query the locale of the user system.
  38. </description>
  39. </method>
  40. <method name="get_locale_name" qualifiers="const">
  41. <return type="String" />
  42. <argument index="0" name="locale" type="String" />
  43. <description>
  44. Returns a locale's language and its variant (e.g. [code]"en_US"[/code] would return [code]"English (United States)"[/code]).
  45. </description>
  46. </method>
  47. <method name="get_translation_object">
  48. <return type="Translation" />
  49. <argument index="0" name="locale" type="String" />
  50. <description>
  51. Returns the [Translation] instance based on the [code]locale[/code] passed in.
  52. It will return a [code]nullptr[/code] if there is no [Translation] instance that matches the [code]locale[/code].
  53. </description>
  54. </method>
  55. <method name="pseudolocalize" qualifiers="const">
  56. <return type="StringName" />
  57. <argument index="0" name="message" type="StringName" />
  58. <description>
  59. Returns the pseudolocalized string based on the [code]p_message[/code] passed in.
  60. </description>
  61. </method>
  62. <method name="reload_pseudolocalization">
  63. <return type="void" />
  64. <description>
  65. Reparses the pseudolocalization options and reloads the translation.
  66. </description>
  67. </method>
  68. <method name="remove_translation">
  69. <return type="void" />
  70. <argument index="0" name="translation" type="Translation" />
  71. <description>
  72. Removes the given translation from the server.
  73. </description>
  74. </method>
  75. <method name="set_locale">
  76. <return type="void" />
  77. <argument index="0" name="locale" type="String" />
  78. <description>
  79. Sets the locale of the project. The [code]locale[/code] string will be standardized to match known locales (e.g. [code]en-US[/code] would be matched to [code]en_US[/code]).
  80. If translations have been loaded beforehand for the new locale, they will be applied.
  81. </description>
  82. </method>
  83. <method name="translate" qualifiers="const">
  84. <return type="StringName" />
  85. <argument index="0" name="message" type="StringName" />
  86. <argument index="1" name="context" type="StringName" default="&quot;&quot;" />
  87. <description>
  88. Returns the current locale's translation for the given message (key) and context.
  89. </description>
  90. </method>
  91. <method name="translate_plural" qualifiers="const">
  92. <return type="StringName" />
  93. <argument index="0" name="message" type="StringName" />
  94. <argument index="1" name="plural_message" type="StringName" />
  95. <argument index="2" name="n" type="int" />
  96. <argument index="3" name="context" type="StringName" default="&quot;&quot;" />
  97. <description>
  98. Returns the current locale's translation for the given message (key), plural_message and context.
  99. The number [code]n[/code] is the number or quantity of the plural object. It will be used to guide the translation system to fetch the correct plural form for the selected language.
  100. </description>
  101. </method>
  102. </methods>
  103. <members>
  104. <member name="pseudolocalization_enabled" type="bool" setter="set_pseudolocalization_enabled" getter="is_pseudolocalization_enabled" default="false">
  105. If [code]true[/code], enables the use of pseudolocalization. See [member ProjectSettings.internationalization/pseudolocalization/use_pseudolocalization] for details.
  106. </member>
  107. </members>
  108. </class>