Interpolation module
@messagevisor/module-interpolation performs lightweight placeholder replacement such as {name}. It is useful when you want simple substitution without bringing in the full ICU syntax model.
Install#
Command
$ npm install @messagevisor/module-interpolationConfigure#
messagevisor.config.js
const { createInterpolationModule } = require("@messagevisor/module-interpolation");module.exports = { modules: [createInterpolationModule()],};What it does well#
- simple
{name}-style replacement - lightweight authoring
- compositions where ICU would be overkill
Custom placeholder patterns#
messagevisor.config.js
createInterpolationModule({ pattern: /%\{([A-Za-z_][A-Za-z0-9_]*)\}/,});This can help if your project needs a placeholder syntax that avoids collisions with another templating system.
Compose with ICU#
Module ordering controls composition. Interpolation can run before ICU when you need both behaviors.
That means you should decide whether:
- interpolation fills placeholders before ICU parsing
- or ICU handles the string first
The right answer depends on how your authored messages are structured.
Edge cases and behavior notes#
This is runtime behavior#
Changing the interpolation module affects:
- SDK output
- CLI evaluation
- examples
- locale tests
- target tests
Simpler does not always mean safer#
Interpolation is great for straightforward replacement, but if you need plural logic, ordinal behavior, or named format presets, ICU is usually the better fit.

