Class “TextResources”

Object > Resources > TextResources

This is the base class for all text resource dictionaries. Instances can be obtained via the from method, or by subclassing. All members of a TextResources (or subclass) instance will be of the type string.

Type: TextResources extends Resources<string, string>
Constructor: protected
Singleton: No
Namespace: tabris
Direct subclasses: None
JSX Support: No

See also:

Resource Management in Tabris.js
Defining raw text resource data in a separate JSON file.
Converting raw text resource data to TextResources instance.
TSX Using a TextResources dictionary [► Run in Playground]

Static Methods

from(base, data)

Creates a texts dictionary from the given raw “data” object. All texts from the given “base” dictionary are inherited unless overwritten.

Entries in the “data” object starting with “$” are considered configuration options and will not become entries in the final texts dictionary.

Parameter Type Description
base Base A plain object or another TextResources instance containing values to inherit by the new TextResources dictionary.
data Data The raw data (plain object) to create the dictionary from. The format must match the Tabris.js texts JSON schema.

Returns: TextResources

from(data)

Creates a texts dictionary from the given raw “data” object. The format must match the Tabris.js texts JSON schema. Entries in the “data” object starting with “$” are considered configuration options and will not become entries in the final texts dictionary.

Parameter Type Description
data Data The raw data (plain object) to create the dictionary from. The format must match the Tabris.js texts JSON schema.

Returns: TextResources