ODLanguageManager_Default class
We are still working the API Reference! This page might be incomplete or doesn't contain all details!
Overview
This is a special class that adds type definitions & typescript to the ODLanguageManager class. It doesn't add any extra features!
This default class is made for the global variable opendiscord.languages!
Methods
Properties
inherited backup type ➜ null|api.ODLanguage
The currently selected backup language. (used when translation missing in current language)
inherited current type ➜ null|api.ODLanguage
The currently selected language.
inherited redirects class ➜ api.ODManagerRedirectHelper
Handle all redirects in this ODManager
Methods
constructor() function ➜ api.ODLanguageManager_Default
(no description)
View Parameters (2)
debug: class ➜api.ODDebugger- Parameter Description Lorem Ipsum.presets: boolean ➜boolean- Parameter Description Lorem Ipsum.
inherited protected _change() function ➜ void
Trigger an onChange() event in the parent ODManager of this class.
inherited add() function ➜ boolean
Add data to the manager. The id will be fetched from the data class! You can optionally select to overwrite existing data!
View Parameters (2)
data: type ➜api.ODLanguage|(api.ODLanguage[])- Parameter Description Lorem Ipsum.overwrite: boolean ➜boolean- Parameter Description Lorem Ipsum.
inherited changed() function ➜ void
(❌ SYSTEM ONLY!!) Set the callback executed when a value inside this class changes.
exists() function ➜ boolean
Check if data that matches the ODId exists. Returns a boolean.
View Parameters (1)
id: type ➜keyof api.ODLanguageManagerIds_Default- Parameter Description Lorem Ipsum.
get() function ➜ null|api.ODLanguage
Get data that matches the ODId. Returns the found data.
View Parameters (1)
id: type ➜api.ODValidId- Parameter Description Lorem Ipsum.
inherited getAll() function ➜ api.ODLanguage[]
Get all data inside this manager
inherited getBackupLanguage() function ➜ null|api.ODLanguage
Get the backup language (same as this.backup)
inherited getCurrentLanguage() function ➜ null|api.ODLanguage
Get the current language (same as this.current)
inherited getCurrentLanguageId() function ➜ string
Get the ID (string) of the current language. (Not backup language)
inherited getFiltered() function ➜ api.ODLanguage[]
Get all data that matches inside the filter function
View Parameters (1)
predicate: function ➜(value:api.ODLanguage, index:number, array:api.ODLanguage[]) => unknown- Parameter Description Lorem Ipsum.
inherited getIds() function ➜ api.ODId[]
Get a list of all the ids inside this manager
inherited getLanguageMetadata() function ➜ null|api.ODLanguageMetadata
Get the metadata of the current/backup language.
View Parameters (1)
frombackup: boolean ➜boolean- Parameter Description Lorem Ipsum.
inherited getLength() function ➜ number
Get the length of the data inside this manager
inherited getRegex() function ➜ api.ODLanguage[]
Get all data that matches the regex
View Parameters (1)
regex: type ➜RegExp- Parameter Description Lorem Ipsum.
getTranslation() function ➜ string
Get a translation string by JSON location. (e.g. "checker.system.typeError")
View Parameters (1)
id: type ➜api.ODLanguageManagerTranslations_Default- Parameter Description Lorem Ipsum.
getTranslationWithParams() function ➜ string
Get a backup translation string by JSON location and replace {0},{1},{2},... with the provided parameters.
View Parameters (2)
id: type ➜api.ODLanguageManagerTranslations_Default- Parameter Description Lorem Ipsum.params: array ➜string[]- Parameter Description Lorem Ipsum.
inherited init() function ➜ Promise
Init all language files.
inherited loopAll() function ➜ Promise
Run an iterator over all data in this manager. This method also supports async-await behaviour!
View Parameters (1)
cb: function ➜(data:api.ODLanguage, id:api.ODId) => api.ODPromiseVoid- Parameter Description Lorem Ipsum.
inherited onAdd() function ➜ void
Listen for when data is added to this manager.
View Parameters (1)
callback: type ➜api.ODManagerAddCallback- Parameter Description Lorem Ipsum.
inherited onChange() function ➜ void
Listen for when data is changed in this manager.
View Parameters (1)
callback: type ➜api.ODManagerCallback- Parameter Description Lorem Ipsum.
inherited onRemove() function ➜ void
Listen for when data is removed from this manager.
View Parameters (1)
callback: type ➜api.ODManagerCallback- Parameter Description Lorem Ipsum.
remove() function ➜ null|api.ODLanguage
Remove data that matches the ODId. Returns the removed data.
View Parameters (1)
id: type ➜api.ODValidId- Parameter Description Lorem Ipsum.
setBackupLanguage() function ➜ void
Set the backup language by providing the ID of a language which is registered in this manager.
View Parameters (1)
id: type ➜keyof api.ODLanguageManagerIds_Default- Parameter Description Lorem Ipsum.
setCurrentLanguage() function ➜ void
Set the current language by providing the ID of a language which is registered in this manager.
View Parameters (1)
id: type ➜keyof api.ODLanguageManagerIds_Default- Parameter Description Lorem Ipsum.
inherited useDebug() function ➜ void
Use the Open Ticket debugger in this manager for logs
View Parameters (2)
debug: class ➜api.ODDebugger- Parameter Description Lorem Ipsum.debugname: string ➜string- Parameter Description Lorem Ipsum.
Defaults
We're still working on this part of the documentation!
Examples
We're still working on this part of the documentation!