FluentBundleBuilder

Builder for immutable FluentBundle instances.

Use FluentBundle.builder or the fluentBundle DSL. The builder is single-use — call build once to materialize the immutable bundle, then discard the builder. Mutating methods are not exposed on FluentBundle itself; the builder is the only way to populate one.

Example

val bundle = FluentBundle.builder(listOf(LanguageIdentifier.parse("en")))
.addResource(FluentResource.tryNew("hi = Hello").getOrThrow())
.addBuiltins()
.setTransform { it.uppercase() }
.build()

Or via the DSL:

val bundle = fluentBundle(listOf(LanguageIdentifier.parse("en"))) {
resource("hi = Hello")
builtins()
transform { it.uppercase() }
}

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

Register the built-in functions (NUMBER, PLURAL, CONCAT, SUM, IDENTITY, DATETIME, DATE, TIME, LIST) on this bundle.

Link copied to clipboard

Add a custom function callable from FTL patterns.

Link copied to clipboard

Add a parsed FluentResource. If a message or term with the same ID already exists, the call returns a failure listing the collisions but does NOT throw — partial registration is preserved.

Link copied to clipboard

Add a resource, overwriting any existing messages or terms with the same ID.

Link copied to clipboard

Materialize the immutable bundle.

Link copied to clipboard

Register the built-in functions. DSL alias for addBuiltins.

Link copied to clipboard

Clear any previously set transform.

Link copied to clipboard

Register a custom function callable from FTL patterns.

Link copied to clipboard

Parse inline FTL source and add it to the bundle.

Parse and add an FTL file from disk (JVM only).

Link copied to clipboard

Alias matching the imperative addResource — same shape, DSL-friendly name.

Link copied to clipboard

Set a custom formatter for FluentValue types. Called by the resolver when a non-string value needs to be rendered.

Link copied to clipboard

Set the transform applied to each text element of every pattern. Useful for pseudolocalization or text normalization.

Link copied to clipboard

Toggle Unicode bidi isolation marks (default on).

Link copied to clipboard

Set the transform applied to every formatted text element.