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() }
}Functions
Register the built-in functions (NUMBER, PLURAL, CONCAT, SUM, IDENTITY, DATETIME, DATE, TIME, LIST) on this bundle.
Add a custom function callable from FTL patterns.
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.
Add a resource, overwriting any existing messages or terms with the same ID.
Materialize the immutable bundle.
Register the built-in functions. DSL alias for addBuiltins.
Clear any previously set transform.
Register a custom function callable from FTL patterns.
Parse inline FTL source and add it to the bundle.
Parse and add an FTL file from disk (JVM only).
Alias matching the imperative addResource — same shape, DSL-friendly name.
Set a custom formatter for FluentValue types. Called by the resolver when a non-string value needs to be rendered.
Set the transform applied to each text element of every pattern. Useful for pseudolocalization or text normalization.
Toggle Unicode bidi isolation marks (default on).
Set the transform applied to every formatted text element.