Core Events
Tolgee events which can be listened through tolgee.on
method.
language
Emitted on language change.
tolgee.on('language', handler: ListenerHandler<string>)
pendingLanguage
Emitted on language change. Before languages are loaded (when tolgee is running).
tolgee.on('pendingLanguage', handler: ListenerHandler<string>)
loading
Emitted on loading change. Changes when tolgee is loading some data for the first time.
tolgee.on('loading', handler: ListenerHandler<boolean>)
fetching
Emitted on fetching change. Changes when tolgee is fetching any data.
tolgee.on('fetching', handler: ListenerHandler<boolean>)
initialLoad
Emitted when run
method finishes.
tolgee.on('initialLoad', handler: ListenerHandler<void>)
running
Emitted when internal running
state changes.
tolgee.on('initialLoad', handler: ListenerHandler<boolean>)
cache
Emitted when cache changes.
tolgee.on('cache', handler: ListenerHandler<CacheDescriptorWithKey>)
update
Emitted when any key needs (or might need) to be re-rendered. Similar to tolgee.onNsUpdate
,
except we intercept all events, not just selection.
tolgee.on('update', handler: ListenerHandler<void>)
error
Emitted when there is an error. You can intercept different types of errors, connected to fetching language data, detecting language or loading/storing language, you can filter them by name
property on the error, which can be:
RecordFetchError
- error when fetching translations record, you can also readlanguage
andnamespace
properties, to see which record has failedLanguageDetectorError
- error when detecting language through language detector pluginLanguageStorageError
- error when loading/saving language through language storage plugin
tolgee.on('error', handler: ListenerHandler<TolgeeError>)