The class used for translations based on the XMLs inside the translations folders.
Made by @NexIsDumb originally for the Poldhub mod.
Static variables
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
.
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
).
staticstringMap:Map<String, IFormatInfo> = []
The current language selected translation map.
It'll never be null
.
Static methods
staticfindAllLanguages():Void
Returns an array that specifies which languages were found.
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
.
staticloadLanguage(lang:String):Map<String, IFormatInfo>
Returns a map of translations based on its XML.
staticraw2Id(str:String):String
Formats a normal string into an ID for translations.
Example: Resume Song
=> resumeSong
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.