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

Static variables

@:native("Singleton")staticread onlySINGLETON:Object

Static methods

@:native("AddTranslation")staticaddTranslation(translation:Translation):Void

Adds a godot.Translation resource.

@:native("Clear")staticclear():Void

Clears the server from all translations.

@:native("GetLoadedLocales")staticgetLoadedLocales():Array

Returns an array of all loaded locales of the project.

@:native("GetLocale")staticgetLocale():String

Returns the current locale of the project.

See also godot.OS.getLocale and godot.OS.getLocaleLanguage to query the locale of the user system.

@:native("GetLocaleName")staticgetLocaleName(locale:String):String

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

@:native("RemoveTranslation")staticremoveTranslation(translation:Translation):Void

Removes the given translation from the server.

@:native("SetLocale")staticsetLocale(locale:String):Void

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.

@:native("Translate")statictranslate(message:String):String

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