This contains the source code documentation of the class DialogicGlossary.


Inherits: Resource

Resource used to store glossary entries. Can be saved to disc and used as a glossary. Add/create glossaries fom the glossaries editor





const RESOURCE_NAME = "Glossary"

No description available.

const NAME_PROPERTY = "name"

No description available.

const ALTERNATIVE_PROPERTY = "alternatives"

No description available.

const TITLE_PROPERTY = "title"

No description available.

const TEXT_PROPERTY = "text"

No description available.

const EXTRA_PROPERTY = "extra"

No description available.

const TRANSLATION_PROPERTY = "_translation_id"

No description available.

const REGEX_OPTION_PROPERTY = "regex_options"

No description available.


No description available.


No description available.

Property Descriptions

var enabled = true

If false, no entries from this glossary will be shown

var entries =

Stores all entries for the glossary. The value may either be a dictionary, representing an entry, or a string, representing the actual key for the key used. The string key-value pairs are the alias keys, they allow to redirect the actual glossary entry.

Method Descriptions

func add_translation_id ( ) ⇒ String

This is automatically called, no need to use this.

func clear_translation_keys ( ) ⇒ void

Clears the lookup tables using translation keys.

func get_entry ( entry_key: String ) ⇒ Dictionary

Gets the glossary entry for the given entry_key. If there is no matching entry, an empty Dictionary will be returned. Valid glossary entry dictionaries will never be empty.

func get_property_translation_key ( entry_key: String, property: String ) ⇒ String

Returns a key used to reference this glossary in the translation CSV file. Time complexity: O(1)

func get_set_glossary_entry_translation_id ( entry_key: String ) ⇒ String

Tries to get the glossary entry's translation ID. If it does not exist, a new one will be generated.

func get_set_glossary_translation_id ( ) ⇒ String

Tries to get the glossary's translation ID. If it does not exist, a new one will be generated.

func get_set_regex_option ( entry_key: String ) ⇒ String

Gets the regex option for the given entry_key. If the regex option does not exist, it will be generated. A regex option is the accumulation of valid words that can trigger the glossary popup. The entry_key must be valid or an error will occur.

func get_word_translation_key ( word: String ) ⇒ String

Returns the matching translation key for the given word. This key can be used via tr to get the translation. Time complexity: O(1) Uses an internal dictionary to find the translation key. This dictionary is generated when the glossary is translated. See _translation_keys.

func remove_entry ( entry_key: String ) ⇒ bool

Removes an entry and all its aliases (alternative property) from the glossary. entry_key may be an entry name or an alias. Returns true if the entry matching the given entry_key was found.

func remove_entry_translation_ids ( ) ⇒ void

Removes the translation ID of all glossary entries.

func remove_translation_id ( ) ⇒ void

Removes the translation ID of this glossary.

func replace_entry_key ( old_entry_key: String, new_entry_key: String ) ⇒ void

Do not use this to update alternative names. In order to update alternative names, delete all with _remove_entry_alias and then add them again with _add_entry_key_alias.

func try_add_entry ( entry: Dictionary ) ⇒ bool

Adds entry to the glossary if it does not exist. If it does exist, returns false.