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 GetScriptName(script string) string
- func GetToolLocale() string
- func GetTranslationObject(locale string) [1]gdclass.Translation
- func PseudolocalizationEnabled() bool
- func Pseudolocalize(message string) string
- func ReloadPseudolocalization()
- 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] resource.
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 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 based on the [param locale] passed in. It will return [code]null[/code] if there is no [Translation] instance that matches the [param locale].
func PseudolocalizationEnabled ¶
func PseudolocalizationEnabled() bool
func Pseudolocalize ¶
Returns the pseudolocalized string based on the [param message] passed in.
func ReloadPseudolocalization ¶
func ReloadPseudolocalization()
Reparses the pseudolocalization options and reloads the translation.
func RemoveTranslation ¶
func RemoveTranslation(translation [1]gdclass.Translation)
Removes the given translation from the server.
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]).
func TranslatePlural ¶
Returns the current locale's translation for the given message (key), 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.
Types ¶
This section is empty.