Generate a type-safe Elm module from a master-language set of ICU messages.
The generator is a pure function from (key, ICU string) pairs to Elm source
text, so it can run anywhere Elm runs (a Node build step, a test, an editor
plugin). It emits one function per key. Each function takes the
Bundle first (I18n-first argument order) followed by a
record of the message's typed arguments; keys with no arguments take only the
bundle.
greeting : Bundle -> { name : String } -> StringNon-master locales are never baked in — they load as data at runtime through
Icu.Bundle, so adding a locale or a translation needs no
regeneration. Only changing the master language's keys or their argument shapes
requires re-running the generator.
Generator options.
moduleName — the fully-qualified name of the module to generate, e.g.
"Translations" or "App.I18n".The inferred type of a message argument, determining the record field type
and which Icu.Format binder the generated code uses.
Infer the type of every argument referenced in a message. When an argument
is used in more than one way, the widest compatible type wins (Float over
Int); a String/number conflict resolves to String.
Turn a key into a valid record field name (same rules as function names).
Generate the Elm module source for the given master-language pairs.
Returns
Errwith(key, error)pairs if any message fails to parse; otherwiseOkwith the module source as aString. Run the output throughelm-formatfor canonical layout.