Skip to content

ResourceStore

Unofficial

Store for managing i18next translation resources.

Import:

import type { ResourceStore } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface ResourceStore

Properties

PropertyTypeDescription
dataRecord<string, Record<string, Record<string, string>>>The underlying resource data.
observersunknownThe registered event observers.
optionsInitOptionsThe options used by this resource store.

Methods

MethodReturnsDescription
addNamespaces(ns)voidAdds namespaces to the store's options.
addResource(lng, ns, key, value, options?)ResourceStoreAdds a single resource entry.
addResourceBundle(lng, ns, resources, deep?, overwrite?)ResourceStoreAdds a resource bundle to the store.
addResources(lng, ns, resources)ResourceStoreAdds multiple resource entries.
getDataByLanguage(lng)Record<string, Record<string, string>> | undefinedGets all resource data for a language.
getResource(lng, ns, key, options?)unknownGets a single resource value.
getResourceBundle(lng, ns)Record<string, unknown>Gets a resource bundle for a language and namespace.
hasResourceBundle(lng, ns)booleanChecks whether a resource bundle exists.
off(event, listener?)voidRemoves a listener for an event.
on(event, listener)voidRegisters a listener for an event.
removeNamespaces(ns)voidRemoves namespaces from the store's options.
removeResourceBundle(lng, ns)ResourceStoreRemoves a resource bundle.
toJSON()Record<string, Record<string, Record<string, string>>>Serializes the store's resource data.

Links to this page: