TranslationServer.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TranslationServer" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. The server responsible for language translations.
  5. </brief_description>
  6. <description>
  7. The server that manages all language translations. Translations can be added to or removed from it.
  8. </description>
  9. <tutorials>
  10. <link title="Internationalizing games">$DOCS_URL/tutorials/i18n/internationalizing_games.html</link>
  11. <link title="Locales">$DOCS_URL/tutorials/i18n/locales.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="add_translation">
  15. <return type="void" />
  16. <param 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="compare_locales" qualifiers="const">
  28. <return type="int" />
  29. <param index="0" name="locale_a" type="String" />
  30. <param index="1" name="locale_b" type="String" />
  31. <description>
  32. Compares two locales and returns a similarity score between [code]0[/code] (no match) and [code]10[/code] (full match).
  33. </description>
  34. </method>
  35. <method name="get_all_countries" qualifiers="const">
  36. <return type="PackedStringArray" />
  37. <description>
  38. Returns an array of known country codes.
  39. </description>
  40. </method>
  41. <method name="get_all_languages" qualifiers="const">
  42. <return type="PackedStringArray" />
  43. <description>
  44. Returns array of known language codes.
  45. </description>
  46. </method>
  47. <method name="get_all_scripts" qualifiers="const">
  48. <return type="PackedStringArray" />
  49. <description>
  50. Returns an array of known script codes.
  51. </description>
  52. </method>
  53. <method name="get_country_name" qualifiers="const">
  54. <return type="String" />
  55. <param index="0" name="country" type="String" />
  56. <description>
  57. Returns a readable country name for the [param country] code.
  58. </description>
  59. </method>
  60. <method name="get_language_name" qualifiers="const">
  61. <return type="String" />
  62. <param index="0" name="language" type="String" />
  63. <description>
  64. Returns a readable language name for the [param language] code.
  65. </description>
  66. </method>
  67. <method name="get_loaded_locales" qualifiers="const">
  68. <return type="PackedStringArray" />
  69. <description>
  70. Returns an array of all loaded locales of the project.
  71. </description>
  72. </method>
  73. <method name="get_locale" qualifiers="const">
  74. <return type="String" />
  75. <description>
  76. Returns the current locale of the project.
  77. See also [method OS.get_locale] and [method OS.get_locale_language] to query the locale of the user system.
  78. </description>
  79. </method>
  80. <method name="get_locale_name" qualifiers="const">
  81. <return type="String" />
  82. <param index="0" name="locale" type="String" />
  83. <description>
  84. Returns a locale's language and its variant (e.g. [code]"en_US"[/code] would return [code]"English (United States)"[/code]).
  85. </description>
  86. </method>
  87. <method name="get_script_name" qualifiers="const">
  88. <return type="String" />
  89. <param index="0" name="script" type="String" />
  90. <description>
  91. Returns a readable script name for the [param script] code.
  92. </description>
  93. </method>
  94. <method name="get_tool_locale">
  95. <return type="String" />
  96. <description>
  97. Returns the current locale of the editor.
  98. [b]Note:[/b] When called from an exported project returns the same value as [method get_locale].
  99. </description>
  100. </method>
  101. <method name="get_translation_object">
  102. <return type="Translation" />
  103. <param index="0" name="locale" type="String" />
  104. <description>
  105. Returns the [Translation] instance based on the [param locale] passed in.
  106. It will return [code]null[/code] if there is no [Translation] instance that matches the [param locale].
  107. </description>
  108. </method>
  109. <method name="pseudolocalize" qualifiers="const">
  110. <return type="StringName" />
  111. <param index="0" name="message" type="StringName" />
  112. <description>
  113. Returns the pseudolocalized string based on the [param message] passed in.
  114. </description>
  115. </method>
  116. <method name="reload_pseudolocalization">
  117. <return type="void" />
  118. <description>
  119. Reparses the pseudolocalization options and reloads the translation.
  120. </description>
  121. </method>
  122. <method name="remove_translation">
  123. <return type="void" />
  124. <param index="0" name="translation" type="Translation" />
  125. <description>
  126. Removes the given translation from the server.
  127. </description>
  128. </method>
  129. <method name="set_locale">
  130. <return type="void" />
  131. <param index="0" name="locale" type="String" />
  132. <description>
  133. Sets the locale of the project. The [param locale] string will be standardized to match known locales (e.g. [code]en-US[/code] would be matched to [code]en_US[/code]).
  134. If translations have been loaded beforehand for the new locale, they will be applied.
  135. </description>
  136. </method>
  137. <method name="standardize_locale" qualifiers="const">
  138. <return type="String" />
  139. <param index="0" name="locale" type="String" />
  140. <description>
  141. Returns a [param locale] string standardized to match known locales (e.g. [code]en-US[/code] would be matched to [code]en_US[/code]).
  142. </description>
  143. </method>
  144. <method name="translate" qualifiers="const">
  145. <return type="StringName" />
  146. <param index="0" name="message" type="StringName" />
  147. <param index="1" name="context" type="StringName" default="&amp;&quot;&quot;" />
  148. <description>
  149. Returns the current locale's translation for the given message (key) and context.
  150. </description>
  151. </method>
  152. <method name="translate_plural" qualifiers="const">
  153. <return type="StringName" />
  154. <param index="0" name="message" type="StringName" />
  155. <param index="1" name="plural_message" type="StringName" />
  156. <param index="2" name="n" type="int" />
  157. <param index="3" name="context" type="StringName" default="&amp;&quot;&quot;" />
  158. <description>
  159. Returns the current locale's translation for the given message (key), plural message and context.
  160. The number [param n] 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.
  161. </description>
  162. </method>
  163. </methods>
  164. <members>
  165. <member name="pseudolocalization_enabled" type="bool" setter="set_pseudolocalization_enabled" getter="is_pseudolocalization_enabled" default="false">
  166. If [code]true[/code], enables the use of pseudolocalization. See [member ProjectSettings.internationalization/pseudolocalization/use_pseudolocalization] for details.
  167. </member>
  168. </members>
  169. </class>