fluentBundle

fun fluentBundle(locales: List<LanguageIdentifier>, useIsolating: Boolean = true, block: FluentBundleBuilder.() -> Unit = {}): FluentBundle(source)

DSL entry point for building an immutable FluentBundle.

val bundle = fluentBundle(locales = listOf(LanguageIdentifier.parse("en-US"))) {
resource("hello = Hello, { $name }!")
resource(File("messages.ftl")) // JVM only
builtins() // registers NUMBER/PLURAL/DATETIME/...
transform { it.uppercase() }
isolating = false
function("HELLO") { args, _ -> FluentValue.Str("Hi ${args.firstOrNull()?.asString()}") }
}

Throws IllegalArgumentException if any resource call fails to parse.

Parameters

locales

Locales this bundle supports (primary locale first).

useIsolating

Default Unicode bidi isolation behavior.

block

Builder configuration.