The server responsible for language translations.
The translation server is the API backend that manages all language translations. Translations are stored in [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 [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 [code]godot.[/code] are reserved for engine internals.
$DOCS_URL/tutorials/i18n/internationalizing_games.html $DOCS_URL/tutorials/i18n/locales.html
Adds a translation to the main translation domain.
Removes all translations from the main translation domain.
Compares two locales and returns a similarity score between [code]0[/code] (no match) and [code]10[/code] (full match).
Returns the [Translation] instances in the main translation domain that match [param locale] (see [method compare_locales]). If [param exact] is [code]true[/code], only instances whose locale exactly equals [param locale] will be returned.
Converts a number from Western Arabic (0..9) to the numeral system used in the given [param locale].
Returns an array of known country codes.
Returns array of known language codes.
Returns an array of known script codes.
Returns a readable country name for the [param country] code.
Returns a readable language name for the [param language] code.
Returns an array of all loaded locales of the project.
Returns the current locale of the project. See also [method OS.get_locale] and [method OS.get_locale_language] to query the locale of the user system.
Returns a locale's language and its variant (e.g. [code]"en_US"[/code] would return [code]"English (United States)"[/code]).
Returns the translation domain with the specified name. An empty translation domain will be created and added if it does not exist.
Returns the percent sign used in the given [param locale].
Returns the default plural rules for the [param locale].
Returns a readable script name for the [param script] code.
Returns the current locale of the editor. [b]Note:[/b] When called from an exported project returns the same value as [method get_locale].
Returns the [Translation] instance that best matches [param locale] in the main translation domain. Returns [code]null[/code] if there are no matches.
Returns all available [Translation] instances in the main translation domain as added by [method add_translation].
Returns [code]true[/code] if a translation domain with the specified name exists.
Returns [code]true[/code] if the main translation domain contains the given [param translation].
Returns [code]true[/code] if there are any [Translation] instances in the main translation domain that match [param locale] (see [method compare_locales]). If [param exact] is [code]true[/code], only instances whose locale exactly equals [param locale] are considered.
Converts [param number] from the numeral system used in the given [param locale] to Western Arabic (0..9).
Returns the pseudolocalized string based on the [param message] passed in. [b]Note:[/b] This method always uses the main translation domain.
Reparses the pseudolocalization options and reloads the translation for the main translation domain.
Removes the translation domain with the specified name. [b]Note:[/b] Trying to remove the main translation domain is an error.
Removes the given translation from the main translation domain.
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]). If translations have been loaded beforehand for the new locale, they will be applied.
Returns a [param locale] string standardized to match known locales (e.g. [code]en-US[/code] would be matched to [code]en_US[/code]). If [param add_defaults] is [code]true[/code], the locale may have a default script or country added.
Returns the current locale's translation for the given message and context. [b]Note:[/b] This method always uses the main translation domain.
Returns the current locale's translation for the given message, plural message and context. 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. [b]Note:[/b] This method always uses the main translation domain.
- If [code]true[/code], enables the use of pseudolocalization on the main translation domain. See [member ProjectSettings.internationalization/pseudolocalization/use_pseudolocalization] for details.