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

Property Type Description
data Record<string, Record<string, Record<string, string>>> The underlying resource data.
observers unknown The registered event observers.
options InitOptions The options used by this resource store.

Methods

Method Returns Description
addNamespaces(ns) void Adds namespaces to the store's options.
addResource(lng, ns, key, value, options?) ResourceStore Adds a single resource entry.
addResourceBundle(lng, ns, resources, deep?, overwrite?) ResourceStore Adds a resource bundle to the store.
addResources(lng, ns, resources) ResourceStore Adds multiple resource entries.
getDataByLanguage(lng) Record<string, Record<string, string>> | undefined Gets all resource data for a language.
getResource(lng, ns, key, options?) unknown Gets a single resource value.
getResourceBundle(lng, ns) Record<string, unknown> Gets a resource bundle for a language and namespace.
hasResourceBundle(lng, ns) boolean Checks whether a resource bundle exists.
off(event, listener?) void Removes a listener for an event.
on(event, listener) void Registers a listener for an event.
removeNamespaces(ns) void Removes namespaces from the store's options.
removeResourceBundle(lng, ns) ResourceStore Removes a resource bundle.
toJSON() Record<string, Record<string, Record<string, string>>> Serializes the store's resource data.

Links to this page: