Documentation
¶
Overview ¶
Package TranslationServer provides methods for working with TranslationServer object instances.
Index ¶
- func AddTranslation(translation [1]gdclass.Translation)
- func Advanced() class
- func Clear()
- func CompareLocales(locale_a string, locale_b string) int
- func GetAllCountries() []string
- func GetAllLanguages() []string
- func GetAllScripts() []string
- func GetCountryName(country string) string
- func GetLanguageName(language string) string
- func GetLoadedLocales() []string
- func GetLocale() string
- func GetLocaleName(locale string) string
- func GetOrAddDomain(domain string) [1]gdclass.TranslationDomain
- func GetScriptName(script string) string
- func GetToolLocale() string
- func GetTranslationObject(locale string) [1]gdclass.Translation
- func HasDomain(domain string) bool
- func PseudolocalizationEnabled() bool
- func Pseudolocalize(message string) string
- func ReloadPseudolocalization()
- func RemoveDomain(domain string)
- func RemoveTranslation(translation [1]gdclass.Translation)
- func SetLocale(locale string)
- func SetPseudolocalizationEnabled(value bool)
- func StandardizeLocale(locale string) string
- func Translate(message string) string
- func TranslatePlural(message string, plural_message string, n int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTranslation ¶
func AddTranslation(translation [1]gdclass.Translation)
Adds a translation to the main translation domain.
func Advanced ¶
func Advanced() class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
func CompareLocales ¶
Compares two locales and returns a similarity score between [code]0[/code] (no match) and [code]10[/code] (full match).
func GetCountryName ¶
Returns a readable country name for the [param country] code.
func GetLanguageName ¶
Returns a readable language name for the [param language] code.
func GetLoadedLocales ¶
func GetLoadedLocales() []string
Returns an array of all loaded locales of the project.
func GetLocale ¶
func GetLocale() string
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.
func GetLocaleName ¶
Returns a locale's language and its variant (e.g. [code]"en_US"[/code] would return [code]"English (United States)"[/code]).
func GetOrAddDomain ¶
func GetOrAddDomain(domain string) [1]gdclass.TranslationDomain
Returns the translation domain with the specified name. An empty translation domain will be created and added if it does not exist.
func GetScriptName ¶
Returns a readable script name for the [param script] code.
func GetToolLocale ¶
func GetToolLocale() string
Returns the current locale of the editor. [b]Note:[/b] When called from an exported project returns the same value as [method get_locale].
func GetTranslationObject ¶
func GetTranslationObject(locale string) [1]gdclass.Translation
Returns the [Translation] instance that best matches [param locale] in the main translation domain. Returns [code]null[/code] if there are no matches.
func PseudolocalizationEnabled ¶
func PseudolocalizationEnabled() bool
func Pseudolocalize ¶
Returns the pseudolocalized string based on the [param message] passed in. [b]Note:[/b] This method always uses the main translation domain.
func ReloadPseudolocalization ¶
func ReloadPseudolocalization()
Reparses the pseudolocalization options and reloads the translation for the main translation domain.
func RemoveDomain ¶
func RemoveDomain(domain string)
Removes the translation domain with the specified name. [b]Note:[/b] Trying to remove the main translation domain is an error.
func RemoveTranslation ¶
func RemoveTranslation(translation [1]gdclass.Translation)
Removes the given translation from the main translation domain.
func SetLocale ¶
func SetLocale(locale string)
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.
func SetPseudolocalizationEnabled ¶
func SetPseudolocalizationEnabled(value bool)
func StandardizeLocale ¶
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.
func Translate ¶
Returns the current locale's translation for the given message and context. [b]Note:[/b] This method always uses the main translation domain.
func TranslatePlural ¶
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.
Types ¶
This section is empty.