Creates a new I18n Brick. Initialization is synchronous for inline
resources; use I18nBrick.create when the options pull in an async
backend and you need to await readiness.
The options for the I18n Brick.
OptionalaiThe intelligence of the Brick instance. This is used to manage the AI capabilities of the Brick.
The key-value store of the Brick instance.
The event emitter of the Brick instance. This is used to emit events that occur in the Brick, such as the running of a program.
This brick's own i18next instance (never the global singleton).
The unique identifier of the Brick instance.
ReadonlyinitResolves once i18next has finished initializing.
The logger used by the Brick instance. This is used to log information about the operation of the Brick.
The name of the Brick instance.
OptionalstructureThe parent Structure of the Brick instance, if any.
The translation function, bound to this brick's instance.
Accumulates token usage/cost across every ask() call on this Brick.
Starts as a .child() of this.ai.usage when an Intelligence is
configured (so totals also roll up there), or standalone otherwise.
Rebound as a .child() of the parent Structure's usage when added
to one via Structure.add().
Gets the current language of the I18n Brick.
Sets the current language of the I18n Brick.
Gets the languages supported by the I18n Brick.
Returns the private map of programs.
Runs a prompt through this Brick's ai, offering its programs (via
Brick.tools) plus any tools attached via Brick.use.
Optionaloptions: AskOptionsRemoves a program from the private map of programs by its name.
The name of the program to remove.
Translates text using the current language.
The text to translate.
Toggles the keep alive flag of the Brick instance, which will prevent the Node process from exiting
A boolean indicating whether to turn the keep alive flag on or off.
Adds a program to the private map of programs.
The program to add.
Runs a program by its name with a given payload.
The name of the program to run.
The payload to pass to the program.
The result of the program.
Schedules a Task to run on a given schedule. This is a wrapper around the cron package.
The Task to schedule.
The scheduled task.
Returns a Task by its name.
Exposes every registered program as a ToolDefinition, each
execute calling this.run(program.name, input).
Every tool this Brick offers: its programs (via Brick.tools) plus anything attached via Brick.use.
Attaches external tool arrays (e.g. MCP-sourced tools) to this Brick,
included whenever ask() builds its tool list.
StaticcreateCreates a brick and waits for i18next initialization to finish.
Optionaloptions: I18nBrickOptions
Class representing an I18n (Internationalization) Brick. It extends from the Brick class.
Example