123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/TranslationDomain.xml.
- .. _class_TranslationDomain:
- TranslationDomain
- =================
- **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- A self-contained collection of :ref:`Translation<class_Translation>` resources.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- **TranslationDomain** is a self-contained collection of :ref:`Translation<class_Translation>` resources. Translations can be added to or removed from it.
- If you're working with the main translation domain, it is more convenient to use the wrap methods on :ref:`TranslationServer<class_TranslationServer>`.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`enabled<class_TranslationDomain_property_enabled>` | ``true`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pseudolocalization_accents_enabled<class_TranslationDomain_property_pseudolocalization_accents_enabled>` | ``true`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pseudolocalization_double_vowels_enabled<class_TranslationDomain_property_pseudolocalization_double_vowels_enabled>` | ``false`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pseudolocalization_enabled<class_TranslationDomain_property_pseudolocalization_enabled>` | ``false`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`pseudolocalization_expansion_ratio<class_TranslationDomain_property_pseudolocalization_expansion_ratio>` | ``0.0`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pseudolocalization_fake_bidi_enabled<class_TranslationDomain_property_pseudolocalization_fake_bidi_enabled>` | ``false`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pseudolocalization_override_enabled<class_TranslationDomain_property_pseudolocalization_override_enabled>` | ``false`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`String<class_String>` | :ref:`pseudolocalization_prefix<class_TranslationDomain_property_pseudolocalization_prefix>` | ``"["`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pseudolocalization_skip_placeholders_enabled<class_TranslationDomain_property_pseudolocalization_skip_placeholders_enabled>` | ``true`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- | :ref:`String<class_String>` | :ref:`pseudolocalization_suffix<class_TranslationDomain_property_pseudolocalization_suffix>` | ``"]"`` |
- +-----------------------------+------------------------------------------------------------------------------------------------------------------------------------+-----------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`add_translation<class_TranslationDomain_method_add_translation>`\ (\ translation\: :ref:`Translation<class_Translation>`\ ) |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`clear<class_TranslationDomain_method_clear>`\ (\ ) |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_locale_override<class_TranslationDomain_method_get_locale_override>`\ (\ ) |const| |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Translation<class_Translation>` | :ref:`get_translation_object<class_TranslationDomain_method_get_translation_object>`\ (\ locale\: :ref:`String<class_String>`\ ) |const| |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`StringName<class_StringName>` | :ref:`pseudolocalize<class_TranslationDomain_method_pseudolocalize>`\ (\ message\: :ref:`StringName<class_StringName>`\ ) |const| |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`remove_translation<class_TranslationDomain_method_remove_translation>`\ (\ translation\: :ref:`Translation<class_Translation>`\ ) |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_locale_override<class_TranslationDomain_method_set_locale_override>`\ (\ locale\: :ref:`String<class_String>`\ ) |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`StringName<class_StringName>` | :ref:`translate<class_TranslationDomain_method_translate>`\ (\ message\: :ref:`StringName<class_StringName>`, context\: :ref:`StringName<class_StringName>` = &""\ ) |const| |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`StringName<class_StringName>` | :ref:`translate_plural<class_TranslationDomain_method_translate_plural>`\ (\ message\: :ref:`StringName<class_StringName>`, message_plural\: :ref:`StringName<class_StringName>`, n\: :ref:`int<class_int>`, context\: :ref:`StringName<class_StringName>` = &""\ ) |const| |
- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_TranslationDomain_property_enabled:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **enabled** = ``true`` :ref:`🔗<class_TranslationDomain_property_enabled>`
- .. rst-class:: classref-property-setget
- - |void| **set_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_enabled**\ (\ )
- If ``true``, translation is enabled. Otherwise, :ref:`translate()<class_TranslationDomain_method_translate>` and :ref:`translate_plural()<class_TranslationDomain_method_translate_plural>` will return the input message unchanged regardless of the current locale.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_accents_enabled:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pseudolocalization_accents_enabled** = ``true`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_accents_enabled>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_accents_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_pseudolocalization_accents_enabled**\ (\ )
- Replace all characters with their accented variants during pseudolocalization.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_double_vowels_enabled:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pseudolocalization_double_vowels_enabled** = ``false`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_double_vowels_enabled>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_double_vowels_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_pseudolocalization_double_vowels_enabled**\ (\ )
- Double vowels in strings during pseudolocalization to simulate the lengthening of text due to localization.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_enabled:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pseudolocalization_enabled** = ``false`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_enabled>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_pseudolocalization_enabled**\ (\ )
- If ``true``, enables pseudolocalization for the project. This can be used to spot untranslatable strings or layout issues that may occur once the project is localized to languages that have longer strings than the source language.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_expansion_ratio:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **pseudolocalization_expansion_ratio** = ``0.0`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_expansion_ratio>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_expansion_ratio**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_pseudolocalization_expansion_ratio**\ (\ )
- The expansion ratio to use during pseudolocalization. A value of ``0.3`` is sufficient for most practical purposes, and will increase the length of each string by 30%.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_fake_bidi_enabled:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pseudolocalization_fake_bidi_enabled** = ``false`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_fake_bidi_enabled>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_fake_bidi_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_pseudolocalization_fake_bidi_enabled**\ (\ )
- If ``true``, emulate bidirectional (right-to-left) text when pseudolocalization is enabled. This can be used to spot issues with RTL layout and UI mirroring that will crop up if the project is localized to RTL languages such as Arabic or Hebrew.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_override_enabled:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pseudolocalization_override_enabled** = ``false`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_override_enabled>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_override_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_pseudolocalization_override_enabled**\ (\ )
- Replace all characters in the string with ``*``. Useful for finding non-localizable strings.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_prefix:
- .. rst-class:: classref-property
- :ref:`String<class_String>` **pseudolocalization_prefix** = ``"["`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_prefix>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_prefix**\ (\ value\: :ref:`String<class_String>`\ )
- - :ref:`String<class_String>` **get_pseudolocalization_prefix**\ (\ )
- Prefix that will be prepended to the pseudolocalized string.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_skip_placeholders_enabled:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pseudolocalization_skip_placeholders_enabled** = ``true`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_skip_placeholders_enabled>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_skip_placeholders_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_pseudolocalization_skip_placeholders_enabled**\ (\ )
- Skip placeholders for string formatting like ``%s`` or ``%f`` during pseudolocalization. Useful to identify strings which need additional control characters to display correctly.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_property_pseudolocalization_suffix:
- .. rst-class:: classref-property
- :ref:`String<class_String>` **pseudolocalization_suffix** = ``"]"`` :ref:`🔗<class_TranslationDomain_property_pseudolocalization_suffix>`
- .. rst-class:: classref-property-setget
- - |void| **set_pseudolocalization_suffix**\ (\ value\: :ref:`String<class_String>`\ )
- - :ref:`String<class_String>` **get_pseudolocalization_suffix**\ (\ )
- Suffix that will be appended to the pseudolocalized string.
- \ **Note:** Updating this property does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` notification manually after you have finished modifying pseudolocalization related options.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_TranslationDomain_method_add_translation:
- .. rst-class:: classref-method
- |void| **add_translation**\ (\ translation\: :ref:`Translation<class_Translation>`\ ) :ref:`🔗<class_TranslationDomain_method_add_translation>`
- Adds a translation.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_method_clear:
- .. rst-class:: classref-method
- |void| **clear**\ (\ ) :ref:`🔗<class_TranslationDomain_method_clear>`
- Removes all translations.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_method_get_locale_override:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_locale_override**\ (\ ) |const| :ref:`🔗<class_TranslationDomain_method_get_locale_override>`
- Returns the locale override of the domain. Returns an empty string if locale override is disabled.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_method_get_translation_object:
- .. rst-class:: classref-method
- :ref:`Translation<class_Translation>` **get_translation_object**\ (\ locale\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_TranslationDomain_method_get_translation_object>`
- Returns the :ref:`Translation<class_Translation>` instance that best matches ``locale``. Returns ``null`` if there are no matches.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_method_pseudolocalize:
- .. rst-class:: classref-method
- :ref:`StringName<class_StringName>` **pseudolocalize**\ (\ message\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_TranslationDomain_method_pseudolocalize>`
- Returns the pseudolocalized string based on the ``message`` passed in.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_method_remove_translation:
- .. rst-class:: classref-method
- |void| **remove_translation**\ (\ translation\: :ref:`Translation<class_Translation>`\ ) :ref:`🔗<class_TranslationDomain_method_remove_translation>`
- Removes the given translation.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_method_set_locale_override:
- .. rst-class:: classref-method
- |void| **set_locale_override**\ (\ locale\: :ref:`String<class_String>`\ ) :ref:`🔗<class_TranslationDomain_method_set_locale_override>`
- Sets the locale override of the domain.
- If ``locale`` is an empty string, locale override is disabled. Otherwise, ``locale`` will be standardized to match known locales (e.g. ``en-US`` would be matched to ``en_US``).
- \ **Note:** Calling this method does not automatically update texts in the scene tree. Please propagate the :ref:`MainLoop.NOTIFICATION_TRANSLATION_CHANGED<class_MainLoop_constant_NOTIFICATION_TRANSLATION_CHANGED>` signal manually.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_method_translate:
- .. rst-class:: classref-method
- :ref:`StringName<class_StringName>` **translate**\ (\ message\: :ref:`StringName<class_StringName>`, context\: :ref:`StringName<class_StringName>` = &""\ ) |const| :ref:`🔗<class_TranslationDomain_method_translate>`
- Returns the current locale's translation for the given message and context.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TranslationDomain_method_translate_plural:
- .. rst-class:: classref-method
- :ref:`StringName<class_StringName>` **translate_plural**\ (\ message\: :ref:`StringName<class_StringName>`, message_plural\: :ref:`StringName<class_StringName>`, n\: :ref:`int<class_int>`, context\: :ref:`StringName<class_StringName>` = &""\ ) |const| :ref:`🔗<class_TranslationDomain_method_translate_plural>`
- Returns the current locale's translation for the given message, plural message and context.
- 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.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|