Codename LogoCodename Logo

funkin.backend.utils.TranslationUtil

APIWikiTools

The class used for translations based on the XMLs inside the translations folders.

Made by @NexIsDumb originally for the Poldhub mod.

Static variables

View on GitHub

staticalternativeStringMap:Map<String, IFormatInfo> = []

The alternative language selected translation map. It is filled with the default language.

This is filled in if the current language is not the same as the default language. Its used when showMissingIds in the config is false (or is not present).

It'll never be null.

View on GitHub

staticconfig:Map<String, String> = []

Returns the current language config.

staticcurLanguage:String

Returns the current language.

staticcurLanguageName:String

Returns the current language name.

View on GitHub

staticfoundLanguages:Array<String> = []

Returns an array has a list of the languages that were found.

staticread onlyisDefaultLanguage:Bool

Returns if the current language is the default one (DEFAULT_LANGUAGE).

staticread onlyisLanguageLoaded:Bool

Returns if any translation are loaded.

View on GitHub

staticstringMap:Map<String, IFormatInfo> = []

The current language selected translation map.

It'll never be null.

Static methods

View on GitHub

staticexists(id:String):Bool

View on GitHub

staticfindAllLanguages():Void

Returns an array that specifies which languages were found.

View on GitHub

staticinlineget(?id:String, ?params:Array<Dynamic>, ?def:String):String

This is for checking and getting a translation, defString it's just the string that gets returned just in case it won't find the translation OR the current language selected is DEFAULT_LANGUAGE.

If id is null then it's gonna search using defString.

View on GitHub

staticgetConfig(lang:String):Map<String, String>

View on GitHub

staticgetLanguageFromName(name:String):String

View on GitHub

staticgetLanguageName(lang:String):String

View on GitHub

staticgetRaw(id:String, ?def:String):IFormatInfo

View on GitHub

staticinlineisAllowed(lang:String):Bool

View on GitHub

staticinlineisBlacklisted(lang:String):Bool

View on GitHub

staticinlineisWhitelisted(lang:String):Bool

View on GitHub

staticloadLanguage(lang:String):Map<String, IFormatInfo>

Returns a map of translations based on its XML.

View on GitHub

staticraw2Id(str:String):String

Formats a normal string into an ID for translations.

Example: Resume Song => resumeSong

View on GitHub

staticsetLanguage(?name:String):Void

Updates the language. Also changes the translations map.

If name is null, its gonna use the current language. If name is not null, it will load the translations for the given language.

View on GitHub

staticinlinetranslate(?id:String, ?params:Array<Dynamic>, ?def:String):String

View on GitHub

staticinlinetranslateDiff(?id:String, ?params:Array<Dynamic>):String

View on GitHub

staticinlinetranslations(key:String):String

View on GitHub

staticinlinetranslationsMain(key:String):String