class_translationserver.rst 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/TranslationServer.xml.
  6. .. _class_TranslationServer:
  7. TranslationServer
  8. =================
  9. **Inherits:** :ref:`Object<class_Object>`
  10. The server responsible for language translations.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The translation server is the API backend that manages all language translations.
  15. Translations are stored in :ref:`TranslationDomain<class_TranslationDomain>`\ s, which can be accessed by name. The most commonly used translation domain is the main translation domain. It always exists and can be accessed using an empty :ref:`StringName<class_StringName>`. The translation server provides wrapper methods for accessing the main translation domain directly, without having to fetch the translation domain first. Custom translation domains are mainly for advanced usages like editor plugins. Names starting with ``godot.`` are reserved for engine internals.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`Internationalizing games <../tutorials/i18n/internationalizing_games>`
  20. - :doc:`Locales <../tutorials/i18n/locales>`
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-------------------------+------------------------------------------------------------------------------------------------+-----------+
  27. | :ref:`bool<class_bool>` | :ref:`pseudolocalization_enabled<class_TranslationServer_property_pseudolocalization_enabled>` | ``false`` |
  28. +-------------------------+------------------------------------------------------------------------------------------------+-----------+
  29. .. rst-class:: classref-reftable-group
  30. Methods
  31. -------
  32. .. table::
  33. :widths: auto
  34. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | |void| | :ref:`add_translation<class_TranslationServer_method_add_translation>`\ (\ translation\: :ref:`Translation<class_Translation>`\ ) |
  36. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | |void| | :ref:`clear<class_TranslationServer_method_clear>`\ (\ ) |
  38. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`compare_locales<class_TranslationServer_method_compare_locales>`\ (\ locale_a\: :ref:`String<class_String>`, locale_b\: :ref:`String<class_String>`\ ) |const| |
  40. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Array<class_Array>`\[:ref:`Translation<class_Translation>`\] | :ref:`find_translations<class_TranslationServer_method_find_translations>`\ (\ locale\: :ref:`String<class_String>`, exact\: :ref:`bool<class_bool>`\ ) |const| |
  42. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`String<class_String>` | :ref:`format_number<class_TranslationServer_method_format_number>`\ (\ number\: :ref:`String<class_String>`, locale\: :ref:`String<class_String>`\ ) |const| |
  44. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_all_countries<class_TranslationServer_method_get_all_countries>`\ (\ ) |const| |
  46. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_all_languages<class_TranslationServer_method_get_all_languages>`\ (\ ) |const| |
  48. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_all_scripts<class_TranslationServer_method_get_all_scripts>`\ (\ ) |const| |
  50. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`String<class_String>` | :ref:`get_country_name<class_TranslationServer_method_get_country_name>`\ (\ country\: :ref:`String<class_String>`\ ) |const| |
  52. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`String<class_String>` | :ref:`get_language_name<class_TranslationServer_method_get_language_name>`\ (\ language\: :ref:`String<class_String>`\ ) |const| |
  54. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_loaded_locales<class_TranslationServer_method_get_loaded_locales>`\ (\ ) |const| |
  56. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`String<class_String>` | :ref:`get_locale<class_TranslationServer_method_get_locale>`\ (\ ) |const| |
  58. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`String<class_String>` | :ref:`get_locale_name<class_TranslationServer_method_get_locale_name>`\ (\ locale\: :ref:`String<class_String>`\ ) |const| |
  60. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`TranslationDomain<class_TranslationDomain>` | :ref:`get_or_add_domain<class_TranslationServer_method_get_or_add_domain>`\ (\ domain\: :ref:`StringName<class_StringName>`\ ) |
  62. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`String<class_String>` | :ref:`get_percent_sign<class_TranslationServer_method_get_percent_sign>`\ (\ locale\: :ref:`String<class_String>`\ ) |const| |
  64. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`String<class_String>` | :ref:`get_plural_rules<class_TranslationServer_method_get_plural_rules>`\ (\ locale\: :ref:`String<class_String>`\ ) |const| |
  66. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`String<class_String>` | :ref:`get_script_name<class_TranslationServer_method_get_script_name>`\ (\ script\: :ref:`String<class_String>`\ ) |const| |
  68. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`String<class_String>` | :ref:`get_tool_locale<class_TranslationServer_method_get_tool_locale>`\ (\ ) |
  70. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`Translation<class_Translation>` | :ref:`get_translation_object<class_TranslationServer_method_get_translation_object>`\ (\ locale\: :ref:`String<class_String>`\ ) |
  72. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`Array<class_Array>`\[:ref:`Translation<class_Translation>`\] | :ref:`get_translations<class_TranslationServer_method_get_translations>`\ (\ ) |const| |
  74. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`bool<class_bool>` | :ref:`has_domain<class_TranslationServer_method_has_domain>`\ (\ domain\: :ref:`StringName<class_StringName>`\ ) |const| |
  76. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`bool<class_bool>` | :ref:`has_translation<class_TranslationServer_method_has_translation>`\ (\ translation\: :ref:`Translation<class_Translation>`\ ) |const| |
  78. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`bool<class_bool>` | :ref:`has_translation_for_locale<class_TranslationServer_method_has_translation_for_locale>`\ (\ locale\: :ref:`String<class_String>`, exact\: :ref:`bool<class_bool>`\ ) |const| |
  80. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`String<class_String>` | :ref:`parse_number<class_TranslationServer_method_parse_number>`\ (\ number\: :ref:`String<class_String>`, locale\: :ref:`String<class_String>`\ ) |const| |
  82. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`StringName<class_StringName>` | :ref:`pseudolocalize<class_TranslationServer_method_pseudolocalize>`\ (\ message\: :ref:`StringName<class_StringName>`\ ) |const| |
  84. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | |void| | :ref:`reload_pseudolocalization<class_TranslationServer_method_reload_pseudolocalization>`\ (\ ) |
  86. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | |void| | :ref:`remove_domain<class_TranslationServer_method_remove_domain>`\ (\ domain\: :ref:`StringName<class_StringName>`\ ) |
  88. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | |void| | :ref:`remove_translation<class_TranslationServer_method_remove_translation>`\ (\ translation\: :ref:`Translation<class_Translation>`\ ) |
  90. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | |void| | :ref:`set_locale<class_TranslationServer_method_set_locale>`\ (\ locale\: :ref:`String<class_String>`\ ) |
  92. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`String<class_String>` | :ref:`standardize_locale<class_TranslationServer_method_standardize_locale>`\ (\ locale\: :ref:`String<class_String>`, add_defaults\: :ref:`bool<class_bool>` = false\ ) |const| |
  94. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`StringName<class_StringName>` | :ref:`translate<class_TranslationServer_method_translate>`\ (\ message\: :ref:`StringName<class_StringName>`, context\: :ref:`StringName<class_StringName>` = &""\ ) |const| |
  96. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`StringName<class_StringName>` | :ref:`translate_plural<class_TranslationServer_method_translate_plural>`\ (\ message\: :ref:`StringName<class_StringName>`, plural_message\: :ref:`StringName<class_StringName>`, n\: :ref:`int<class_int>`, context\: :ref:`StringName<class_StringName>` = &""\ ) |const| |
  98. +--------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. .. rst-class:: classref-section-separator
  100. ----
  101. .. rst-class:: classref-descriptions-group
  102. Property Descriptions
  103. ---------------------
  104. .. _class_TranslationServer_property_pseudolocalization_enabled:
  105. .. rst-class:: classref-property
  106. :ref:`bool<class_bool>` **pseudolocalization_enabled** = ``false`` :ref:`🔗<class_TranslationServer_property_pseudolocalization_enabled>`
  107. .. rst-class:: classref-property-setget
  108. - |void| **set_pseudolocalization_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  109. - :ref:`bool<class_bool>` **is_pseudolocalization_enabled**\ (\ )
  110. If ``true``, enables the use of pseudolocalization on the main translation domain. See :ref:`ProjectSettings.internationalization/pseudolocalization/use_pseudolocalization<class_ProjectSettings_property_internationalization/pseudolocalization/use_pseudolocalization>` for details.
  111. .. rst-class:: classref-section-separator
  112. ----
  113. .. rst-class:: classref-descriptions-group
  114. Method Descriptions
  115. -------------------
  116. .. _class_TranslationServer_method_add_translation:
  117. .. rst-class:: classref-method
  118. |void| **add_translation**\ (\ translation\: :ref:`Translation<class_Translation>`\ ) :ref:`🔗<class_TranslationServer_method_add_translation>`
  119. Adds a translation to the main translation domain.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_TranslationServer_method_clear:
  123. .. rst-class:: classref-method
  124. |void| **clear**\ (\ ) :ref:`🔗<class_TranslationServer_method_clear>`
  125. Removes all translations from the main translation domain.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_TranslationServer_method_compare_locales:
  129. .. rst-class:: classref-method
  130. :ref:`int<class_int>` **compare_locales**\ (\ locale_a\: :ref:`String<class_String>`, locale_b\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_compare_locales>`
  131. Compares two locales and returns a similarity score between ``0`` (no match) and ``10`` (full match).
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_TranslationServer_method_find_translations:
  135. .. rst-class:: classref-method
  136. :ref:`Array<class_Array>`\[:ref:`Translation<class_Translation>`\] **find_translations**\ (\ locale\: :ref:`String<class_String>`, exact\: :ref:`bool<class_bool>`\ ) |const| :ref:`🔗<class_TranslationServer_method_find_translations>`
  137. Returns the :ref:`Translation<class_Translation>` instances in the main translation domain that match ``locale`` (see :ref:`compare_locales()<class_TranslationServer_method_compare_locales>`). If ``exact`` is ``true``, only instances whose locale exactly equals ``locale`` will be returned.
  138. .. rst-class:: classref-item-separator
  139. ----
  140. .. _class_TranslationServer_method_format_number:
  141. .. rst-class:: classref-method
  142. :ref:`String<class_String>` **format_number**\ (\ number\: :ref:`String<class_String>`, locale\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_format_number>`
  143. Converts a number from Western Arabic (0..9) to the numeral system used in the given ``locale``.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_TranslationServer_method_get_all_countries:
  147. .. rst-class:: classref-method
  148. :ref:`PackedStringArray<class_PackedStringArray>` **get_all_countries**\ (\ ) |const| :ref:`🔗<class_TranslationServer_method_get_all_countries>`
  149. Returns an array of known country codes.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_TranslationServer_method_get_all_languages:
  153. .. rst-class:: classref-method
  154. :ref:`PackedStringArray<class_PackedStringArray>` **get_all_languages**\ (\ ) |const| :ref:`🔗<class_TranslationServer_method_get_all_languages>`
  155. Returns array of known language codes.
  156. .. rst-class:: classref-item-separator
  157. ----
  158. .. _class_TranslationServer_method_get_all_scripts:
  159. .. rst-class:: classref-method
  160. :ref:`PackedStringArray<class_PackedStringArray>` **get_all_scripts**\ (\ ) |const| :ref:`🔗<class_TranslationServer_method_get_all_scripts>`
  161. Returns an array of known script codes.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_TranslationServer_method_get_country_name:
  165. .. rst-class:: classref-method
  166. :ref:`String<class_String>` **get_country_name**\ (\ country\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_get_country_name>`
  167. Returns a readable country name for the ``country`` code.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_TranslationServer_method_get_language_name:
  171. .. rst-class:: classref-method
  172. :ref:`String<class_String>` **get_language_name**\ (\ language\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_get_language_name>`
  173. Returns a readable language name for the ``language`` code.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_TranslationServer_method_get_loaded_locales:
  177. .. rst-class:: classref-method
  178. :ref:`PackedStringArray<class_PackedStringArray>` **get_loaded_locales**\ (\ ) |const| :ref:`🔗<class_TranslationServer_method_get_loaded_locales>`
  179. Returns an array of all loaded locales of the project.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_TranslationServer_method_get_locale:
  183. .. rst-class:: classref-method
  184. :ref:`String<class_String>` **get_locale**\ (\ ) |const| :ref:`🔗<class_TranslationServer_method_get_locale>`
  185. Returns the current locale of the project.
  186. See also :ref:`OS.get_locale()<class_OS_method_get_locale>` and :ref:`OS.get_locale_language()<class_OS_method_get_locale_language>` to query the locale of the user system.
  187. .. rst-class:: classref-item-separator
  188. ----
  189. .. _class_TranslationServer_method_get_locale_name:
  190. .. rst-class:: classref-method
  191. :ref:`String<class_String>` **get_locale_name**\ (\ locale\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_get_locale_name>`
  192. Returns a locale's language and its variant (e.g. ``"en_US"`` would return ``"English (United States)"``).
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_TranslationServer_method_get_or_add_domain:
  196. .. rst-class:: classref-method
  197. :ref:`TranslationDomain<class_TranslationDomain>` **get_or_add_domain**\ (\ domain\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_TranslationServer_method_get_or_add_domain>`
  198. Returns the translation domain with the specified name. An empty translation domain will be created and added if it does not exist.
  199. .. rst-class:: classref-item-separator
  200. ----
  201. .. _class_TranslationServer_method_get_percent_sign:
  202. .. rst-class:: classref-method
  203. :ref:`String<class_String>` **get_percent_sign**\ (\ locale\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_get_percent_sign>`
  204. Returns the percent sign used in the given ``locale``.
  205. .. rst-class:: classref-item-separator
  206. ----
  207. .. _class_TranslationServer_method_get_plural_rules:
  208. .. rst-class:: classref-method
  209. :ref:`String<class_String>` **get_plural_rules**\ (\ locale\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_get_plural_rules>`
  210. Returns the default plural rules for the ``locale``.
  211. .. rst-class:: classref-item-separator
  212. ----
  213. .. _class_TranslationServer_method_get_script_name:
  214. .. rst-class:: classref-method
  215. :ref:`String<class_String>` **get_script_name**\ (\ script\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_get_script_name>`
  216. Returns a readable script name for the ``script`` code.
  217. .. rst-class:: classref-item-separator
  218. ----
  219. .. _class_TranslationServer_method_get_tool_locale:
  220. .. rst-class:: classref-method
  221. :ref:`String<class_String>` **get_tool_locale**\ (\ ) :ref:`🔗<class_TranslationServer_method_get_tool_locale>`
  222. Returns the current locale of the editor.
  223. \ **Note:** When called from an exported project returns the same value as :ref:`get_locale()<class_TranslationServer_method_get_locale>`.
  224. .. rst-class:: classref-item-separator
  225. ----
  226. .. _class_TranslationServer_method_get_translation_object:
  227. .. rst-class:: classref-method
  228. :ref:`Translation<class_Translation>` **get_translation_object**\ (\ locale\: :ref:`String<class_String>`\ ) :ref:`🔗<class_TranslationServer_method_get_translation_object>`
  229. **Deprecated:** Use :ref:`find_translations()<class_TranslationServer_method_find_translations>` instead.
  230. Returns the :ref:`Translation<class_Translation>` instance that best matches ``locale`` in the main translation domain. Returns ``null`` if there are no matches.
  231. .. rst-class:: classref-item-separator
  232. ----
  233. .. _class_TranslationServer_method_get_translations:
  234. .. rst-class:: classref-method
  235. :ref:`Array<class_Array>`\[:ref:`Translation<class_Translation>`\] **get_translations**\ (\ ) |const| :ref:`🔗<class_TranslationServer_method_get_translations>`
  236. Returns all available :ref:`Translation<class_Translation>` instances in the main translation domain as added by :ref:`add_translation()<class_TranslationServer_method_add_translation>`.
  237. .. rst-class:: classref-item-separator
  238. ----
  239. .. _class_TranslationServer_method_has_domain:
  240. .. rst-class:: classref-method
  241. :ref:`bool<class_bool>` **has_domain**\ (\ domain\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_TranslationServer_method_has_domain>`
  242. Returns ``true`` if a translation domain with the specified name exists.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_TranslationServer_method_has_translation:
  246. .. rst-class:: classref-method
  247. :ref:`bool<class_bool>` **has_translation**\ (\ translation\: :ref:`Translation<class_Translation>`\ ) |const| :ref:`🔗<class_TranslationServer_method_has_translation>`
  248. Returns ``true`` if the main translation domain contains the given ``translation``.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_TranslationServer_method_has_translation_for_locale:
  252. .. rst-class:: classref-method
  253. :ref:`bool<class_bool>` **has_translation_for_locale**\ (\ locale\: :ref:`String<class_String>`, exact\: :ref:`bool<class_bool>`\ ) |const| :ref:`🔗<class_TranslationServer_method_has_translation_for_locale>`
  254. Returns ``true`` if there are any :ref:`Translation<class_Translation>` instances in the main translation domain that match ``locale`` (see :ref:`compare_locales()<class_TranslationServer_method_compare_locales>`). If ``exact`` is ``true``, only instances whose locale exactly equals ``locale`` are considered.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_TranslationServer_method_parse_number:
  258. .. rst-class:: classref-method
  259. :ref:`String<class_String>` **parse_number**\ (\ number\: :ref:`String<class_String>`, locale\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationServer_method_parse_number>`
  260. Converts ``number`` from the numeral system used in the given ``locale`` to Western Arabic (0..9).
  261. .. rst-class:: classref-item-separator
  262. ----
  263. .. _class_TranslationServer_method_pseudolocalize:
  264. .. rst-class:: classref-method
  265. :ref:`StringName<class_StringName>` **pseudolocalize**\ (\ message\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_TranslationServer_method_pseudolocalize>`
  266. Returns the pseudolocalized string based on the ``message`` passed in.
  267. \ **Note:** This method always uses the main translation domain.
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_TranslationServer_method_reload_pseudolocalization:
  271. .. rst-class:: classref-method
  272. |void| **reload_pseudolocalization**\ (\ ) :ref:`🔗<class_TranslationServer_method_reload_pseudolocalization>`
  273. Reparses the pseudolocalization options and reloads the translation for the main translation domain.
  274. .. rst-class:: classref-item-separator
  275. ----
  276. .. _class_TranslationServer_method_remove_domain:
  277. .. rst-class:: classref-method
  278. |void| **remove_domain**\ (\ domain\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_TranslationServer_method_remove_domain>`
  279. Removes the translation domain with the specified name.
  280. \ **Note:** Trying to remove the main translation domain is an error.
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _class_TranslationServer_method_remove_translation:
  284. .. rst-class:: classref-method
  285. |void| **remove_translation**\ (\ translation\: :ref:`Translation<class_Translation>`\ ) :ref:`🔗<class_TranslationServer_method_remove_translation>`
  286. Removes the given translation from the main translation domain.
  287. .. rst-class:: classref-item-separator
  288. ----
  289. .. _class_TranslationServer_method_set_locale:
  290. .. rst-class:: classref-method
  291. |void| **set_locale**\ (\ locale\: :ref:`String<class_String>`\ ) :ref:`🔗<class_TranslationServer_method_set_locale>`
  292. Sets the locale of the project. The ``locale`` string will be standardized to match known locales (e.g. ``en-US`` would be matched to ``en_US``).
  293. If translations have been loaded beforehand for the new locale, they will be applied.
  294. .. rst-class:: classref-item-separator
  295. ----
  296. .. _class_TranslationServer_method_standardize_locale:
  297. .. rst-class:: classref-method
  298. :ref:`String<class_String>` **standardize_locale**\ (\ locale\: :ref:`String<class_String>`, add_defaults\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_TranslationServer_method_standardize_locale>`
  299. Returns a ``locale`` string standardized to match known locales (e.g. ``en-US`` would be matched to ``en_US``). If ``add_defaults`` is ``true``, the locale may have a default script or country added.
  300. .. rst-class:: classref-item-separator
  301. ----
  302. .. _class_TranslationServer_method_translate:
  303. .. rst-class:: classref-method
  304. :ref:`StringName<class_StringName>` **translate**\ (\ message\: :ref:`StringName<class_StringName>`, context\: :ref:`StringName<class_StringName>` = &""\ ) |const| :ref:`🔗<class_TranslationServer_method_translate>`
  305. Returns the current locale's translation for the given message and context.
  306. \ **Note:** This method always uses the main translation domain.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _class_TranslationServer_method_translate_plural:
  310. .. rst-class:: classref-method
  311. :ref:`StringName<class_StringName>` **translate_plural**\ (\ message\: :ref:`StringName<class_StringName>`, plural_message\: :ref:`StringName<class_StringName>`, n\: :ref:`int<class_int>`, context\: :ref:`StringName<class_StringName>` = &""\ ) |const| :ref:`🔗<class_TranslationServer_method_translate_plural>`
  312. Returns the current locale's translation for the given message, plural message and context.
  313. The number ``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.
  314. \ **Note:** This method always uses the main translation domain.
  315. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  316. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  317. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  318. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  319. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  320. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  321. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  322. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  323. .. |void| replace:: :abbr:`void (No return value.)`