TranslationServer

Inherits: Object

Server that manages all translations.

Description

Server that manages all translations. Translations can be set to it and removed from it.

Methods

void

add_translation ( Translation translation )

void

clear ( )

Array

get_loaded_locales ( ) const

String

get_locale ( ) const

String

get_locale_name ( String locale ) const

void

remove_translation ( Translation translation )

void

set_locale ( String locale )

String

translate ( String message ) const

Method Descriptions

Adds a Translation resource.


  • void clear ( )

Clears the server from all translations.


  • Array get_loaded_locales ( ) const

Returns an array of all loaded locales of the project.


Returns the current locale of the project.

See also OS.get_locale and OS.get_locale_language to query the locale of the user system.


Returns a locale's language and its variant (e.g. "en_US" would return "English (United States)").


Removes the given translation from the server.


  • void set_locale ( String locale )

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).

If translations have been loaded beforehand for the new locale, they will be applied.


Returns the current locale's translation for the given message (key).