[{"name":"Icu.Ast","comment":" The abstract syntax tree for an ICU MessageFormat message.\n\nA parsed message is a list of [`Part`](#Part)s. This module is the shared\nrepresentation that a parser produces and that a formatter or code generator\nconsumes — it deliberately mirrors the structure of the\n[ICU syntax](https://formatjs.github.io/docs/core-concepts/icu-syntax).\n\n@docs Message, Part\n@docs PluralForm, PluralSelector\n@docs argumentNames\n\n","unions":[{"name":"Part","comment":" A single piece of a message.\n\n  - `Literal` — raw text, e.g. `Hello`. ICU quoting (`''`, `'{'`) is resolved\n    by the parser, so a `Literal` holds the already-unescaped text.\n  - `Argument` — a bare placeholder `{name}`.\n  - `Number` / `Date` / `Time` — a typed placeholder such as `{n, number}` or\n    `{d, date, long}`, with an optional style/skeleton string.\n  - `Select` — `{g, select, ...}`, a plain keyword switch with a mandatory\n    `other` branch.\n  - `Plural` — `{n, plural, ...}` or `{n, selectordinal, ...}`. `ordinal`\n    distinguishes the two; `offset` carries `offset:N`.\n  - `Pound` — the `#` placeholder inside a plural branch, replaced by the\n    (offset-adjusted) argument value.\n\n","args":[],"cases":[["Literal",["String.String"]],["Argument",["String.String"]],["Number",["String.String","Maybe.Maybe String.String"]],["Date",["String.String","Maybe.Maybe String.String"]],["Time",["String.String","Maybe.Maybe String.String"]],["Select",["String.String","List.List ( String.String, Icu.Ast.Message )","Icu.Ast.Message"]],["Plural",["{ arg : String.String, ordinal : Basics.Bool, offset : Basics.Int, forms : List.List Icu.Ast.PluralForm, other : Icu.Ast.Message }"]],["Pound",[]]]},{"name":"PluralSelector","comment":" Selects which plural branch applies: either an exact literal match\n(`=0`, `=1`, ...) or a CLDR plural keyword (`zero`, `one`, `two`, `few`,\n`many`). The `other` branch is stored separately on [`Part.Plural`](#Part).\n","args":[],"cases":[["Exact",["Basics.Int"]],["Keyword",["String.String"]]]}],"aliases":[{"name":"Message","comment":" A message is an ordered sequence of parts. Rendering the message means\nrendering each part in turn and concatenating the results.\n","args":[],"type":"List.List Icu.Ast.Part"},{"name":"PluralForm","comment":" One branch of a `plural` / `selectordinal` block, e.g. `one {...}` or\n`=0 {...}`.\n","args":[],"type":"( Icu.Ast.PluralSelector, Icu.Ast.Message )"}],"values":[{"name":"argumentNames","comment":" Collect every argument name referenced anywhere in a message, including\nthose nested inside `select` and `plural` branches. Order of first appearance\nis preserved and duplicates are removed.\n","type":"Icu.Ast.Message -> List.List String.String"}],"binops":[]},{"name":"Icu.Bundle","comment":" A runtime store of translations for the generated code to target.\n\nA `Bundle` holds the `Intl` handle, the active `Locale`, the active locale's\nmessages, and a set of fallback messages (the master language). Keys missing\nfrom the active locale fall back to the master, so a locale can ship partial\ntranslations. New locales are loaded as data at runtime — adding one requires no\nrecompile.\n\n@docs Bundle, Messages\n@docs fromMessages, decodeMessages, parseMessages\n@docs withLocale, currentLocale\n@docs translate\n\n","unions":[{"name":"Bundle","comment":" An opaque runtime translation store.\n","args":[],"cases":[]}],"aliases":[{"name":"Messages","comment":" A map from translation key to its parsed message.\n","args":[],"type":"Dict.Dict String.String Icu.Ast.Message"}],"values":[{"name":"currentLocale","comment":" The bundle's currently active locale.\n","type":"Icu.Bundle.Bundle -> Icu.Locale.Locale"},{"name":"decodeMessages","comment":" Parse a JSON object of `{ \"key\": \"ICU string\", ... }` into [`Messages`](#Messages).\n\nReturns the list of `(key, parseError)` pairs for any values that are not valid\nICU, alongside the messages that did parse. This is total: a malformed entry is\nreported but does not abort the whole load.\n\n","type":"String.String -> Result.Result Json.Decode.Error ( Icu.Bundle.Messages, List.List ( String.String, String.String ) )"},{"name":"fromMessages","comment":" Build a bundle from already-parsed messages. The messages passed here serve\nas both the active locale and the fallback (they are the master language).\nGenerated code calls this in its `init`.\n","type":"Intl.Intl -> Icu.Locale.Locale -> Icu.Bundle.Messages -> Icu.Bundle.Bundle"},{"name":"parseMessages","comment":" Parse an association list of `(key, ICU string)` into messages, collecting\nany per-key parse errors. Exposed for callers that already have the pairs (e.g.\ngenerated code baking in the master language).\n","type":"List.List ( String.String, String.String ) -> ( Icu.Bundle.Messages, List.List ( String.String, String.String ) )"},{"name":"translate","comment":" Format the message for `key` with the given arguments, formatting for the\nactive locale. If the key is absent from the active locale it falls back to the\nmaster language; if it is absent there too, the key itself is returned so the\ngap is visible.\n","type":"Icu.Bundle.Bundle -> String.String -> Icu.Format.Args -> String.String"},{"name":"withLocale","comment":" Switch the active locale, replacing the active messages. The fallback\n(master) messages are preserved, so keys missing from the new locale still\nresolve.\n","type":"Icu.Locale.Locale -> Icu.Bundle.Messages -> Icu.Bundle.Bundle -> Icu.Bundle.Bundle"}],"binops":[]},{"name":"Icu.Codegen","comment":" Generate a type-safe Elm module from a master-language set of ICU messages.\n\nThe generator is a pure function from `(key, ICU string)` pairs to Elm source\ntext, so it can run anywhere Elm runs (a Node build step, a test, an editor\nplugin). It emits one function per key. Each function takes the\n[`Bundle`](Icu-Bundle#Bundle) first (I18n-first argument order) followed by a\nrecord of the message's typed arguments; keys with no arguments take only the\nbundle.\n\n    greeting : Bundle -> { name : String } -> String\n\nNon-master locales are never baked in — they load as data at runtime through\n[`Icu.Bundle`](Icu-Bundle), so adding a locale or a translation needs no\nregeneration. Only changing the master language's keys or their argument shapes\nrequires re-running the generator.\n\n@docs generate, Options\n@docs ArgType, inferArgTypes, fieldName\n\n","unions":[{"name":"ArgType","comment":" The inferred type of a message argument, determining the record field type\nand which [`Icu.Format`](Icu-Format) binder the generated code uses.\n","args":[],"cases":[["TString",[]],["TInt",[]],["TFloat",[]],["TTime",[]]]}],"aliases":[{"name":"Options","comment":" Generator options.\n\n  - `moduleName` — the fully-qualified name of the module to generate, e.g.\n    `\"Translations\"` or `\"App.I18n\"`.\n\n","args":[],"type":"{ moduleName : String.String }"}],"values":[{"name":"fieldName","comment":" Turn a key into a valid record field name (same rules as function names).\n","type":"String.String -> String.String"},{"name":"generate","comment":" Generate the Elm module source for the given master-language pairs.\n\nReturns `Err` with `(key, error)` pairs if any message fails to parse; otherwise\n`Ok` with the module source as a `String`. Run the output through `elm-format`\nfor canonical layout.\n\n","type":"Icu.Codegen.Options -> List.List ( String.String, String.String ) -> Result.Result (List.List ( String.String, String.String )) String.String"},{"name":"inferArgTypes","comment":" Infer the type of every argument referenced in a message. When an argument\nis used in more than one way, the widest compatible type wins (`Float` over\n`Int`); a `String`/number conflict resolves to `String`.\n","type":"Icu.Ast.Message -> Dict.Dict String.String Icu.Codegen.ArgType"}],"binops":[]},{"name":"Icu.Format","comment":" Format a parsed ICU [`Message`](Icu-Ast#Message) into a `String`, using the\nbrowser [`Intl`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)\nAPI (via [`anmolitor/intl-proxy`](https://package.elm-lang.org/packages/anmolitor/intl-proxy/latest/))\nfor locale-correct plural selection and number/date formatting.\n\nYou obtain the `Intl` value once at startup by decoding a flag with\n[`Intl.decode`](https://package.elm-lang.org/packages/anmolitor/intl-proxy/latest/Intl#decode),\npassing `window.Intl` in through JavaScript.\n\n@docs format, formatWith\n@docs Args, args, string, int, float, time\n\n","unions":[{"name":"Args","comment":" A collection of named argument values to substitute into a message. Build\none with [`args`](#args) and the value helpers.\n","args":[],"cases":[]}],"aliases":[],"values":[{"name":"args","comment":" An empty argument set to pipe values into.\n\n    Icu.Format.args\n        |> Icu.Format.string \"name\" \"Alice\"\n        |> Icu.Format.int \"count\" 3\n\n","type":"Icu.Format.Args"},{"name":"float","comment":" Bind a floating-point argument (for `number` and `plural`).\n","type":"String.String -> Basics.Float -> Icu.Format.Args -> Icu.Format.Args"},{"name":"format","comment":" Format a message for a locale with the given arguments.\n\n    Icu.Format.format intl\n        locale\n        (Icu.Format.args |> Icu.Format.string \"name\" \"Alice\")\n        message\n\n","type":"Intl.Intl -> Icu.Locale.Locale -> Icu.Format.Args -> Icu.Ast.Message -> String.String"},{"name":"formatWith","comment":" Like [`format`](#format), but takes the argument dictionary directly. Useful\nfor generated code that already has a `Dict String Value`.\n","type":"Intl.Intl -> Icu.Locale.Locale -> Dict.Dict String.String Icu.Value.Value -> Icu.Ast.Message -> String.String"},{"name":"int","comment":" Bind an integer argument (for `number`, `plural`, `selectordinal`).\n","type":"String.String -> Basics.Int -> Icu.Format.Args -> Icu.Format.Args"},{"name":"string","comment":" Bind a string argument (for `{name}` and `select`).\n","type":"String.String -> String.String -> Icu.Format.Args -> Icu.Format.Args"},{"name":"time","comment":" Bind a time argument (for `date` and `time`).\n","type":"String.String -> Time.Posix -> Icu.Format.Args -> Icu.Format.Args"}],"binops":[]},{"name":"Icu.Locale","comment":" Parse and resolve [BCP 47](https://www.rfc-editor.org/info/bcp47) language\ntags.\n\nThis module lets you match a requested locale (or a prioritized list of\nrequested locales, as in an HTTP `Accept-Language` header) against the set of\nlocales you actually have translations for — without hard-coding which locales\nexist. New translations can be added as data at runtime and resolution keeps\nworking.\n\n@docs Locale\n@docs default\n@docs fromString, toString\n@docs language, script, region, variants\n@docs fallbacks, bestMatch, negotiate\n\n","unions":[{"name":"Locale","comment":" A parsed, canonicalized BCP 47 language tag.\n\nCanonical case is applied on parse: language lowercase (`en`), script in title\ncase (`Latn`), region uppercase (`US`), variants lowercase. Extension and\nprivate-use subtags (`-u-…`, `-x-…`) are not retained — they don't affect\ntranslation lookup.\n\n","args":[],"cases":[]}],"aliases":[],"values":[{"name":"bestMatch","comment":" Find the best available locale for a single requested locale, using the\n[`fallbacks`](#fallbacks) chain. The requested locale is progressively\ngeneralized until one of the `available` locales matches exactly (in canonical\nform); returns `Nothing` if nothing matches.\n\n    resolve want =\n        [ \"en\", \"en-GB\", \"fr\" ]\n            |> List.filterMap fromString\n            |> (\\avail -> fromString want |> Maybe.andThen (bestMatch avail))\n            |> Maybe.map toString\n\n    resolve \"en-US\" --> Just \"en\"\n    resolve \"en-GB\" --> Just \"en-GB\"\n    resolve \"de\"    --> Nothing\n\n","type":"List.List Icu.Locale.Locale -> Icu.Locale.Locale -> Maybe.Maybe Icu.Locale.Locale"},{"name":"default","comment":" The `en` locale — a sensible total default when no locale has been\nnegotiated yet, so callers can hold a concrete `Locale` (and thus a concrete\n`Bundle`) without threading a `Maybe` everywhere.\n\n    toString default\n    --> \"en\"\n\n","type":"Icu.Locale.Locale"},{"name":"fallbacks","comment":" The fallback chain for a locale, most specific first, following RFC 4647\n\"lookup\" truncation: trailing subtags are dropped one group at a time down to\nthe bare language.\n\n    fromString \"zh-Hant-TW\"\n        |> Maybe.map (fallbacks >> List.map toString)\n    --> Just [ \"zh-Hant-TW\", \"zh-Hant\", \"zh\" ]\n\n","type":"Icu.Locale.Locale -> List.List Icu.Locale.Locale"},{"name":"fromString","comment":" Parse a BCP 47 tag such as `\"en\"`, `\"en-US\"`, `\"zh-Hant-TW\"`, or\n`\"sr-Latn-RS\"`. Both `-` and `_` are accepted as separators. Returns `Nothing`\nif there is no valid primary language subtag.\n\n    fromString \"en-US\" |> Maybe.map toString\n    --> Just \"en-US\"\n\n    fromString \"ZH_hant_tw\" |> Maybe.map toString\n    --> Just \"zh-Hant-TW\"\n\n","type":"String.String -> Maybe.Maybe Icu.Locale.Locale"},{"name":"language","comment":" The primary language subtag, e.g. `\"en\"`.\n","type":"Icu.Locale.Locale -> String.String"},{"name":"negotiate","comment":" Negotiate against a prioritized list of requested locales (highest priority\nfirst, as in an `Accept-Language` header). Returns the [`bestMatch`](#bestMatch)\nfor the first requested locale that resolves.\n\n    let\n        avail =\n            List.filterMap fromString [ \"en\", \"fr-CA\", \"fr\" ]\n        wanted =\n            List.filterMap fromString [ \"de\", \"fr-FR\", \"en\" ]\n    in\n    negotiate avail wanted |> Maybe.map toString\n    --> Just \"fr\"\n\n","type":"List.List Icu.Locale.Locale -> List.List Icu.Locale.Locale -> Maybe.Maybe Icu.Locale.Locale"},{"name":"region","comment":" The region subtag, if present, e.g. `Just \"US\"`.\n","type":"Icu.Locale.Locale -> Maybe.Maybe String.String"},{"name":"script","comment":" The script subtag, if present, e.g. `Just \"Hant\"`.\n","type":"Icu.Locale.Locale -> Maybe.Maybe String.String"},{"name":"toString","comment":" Render a `Locale` back to its canonical string form.\n","type":"Icu.Locale.Locale -> String.String"},{"name":"variants","comment":" The variant subtags, if any.\n","type":"Icu.Locale.Locale -> List.List String.String"}],"binops":[]},{"name":"Icu.Parser","comment":" Parse an [ICU MessageFormat](https://formatjs.github.io/docs/core-concepts/icu-syntax)\nstring into an [`Icu.Ast.Message`](Icu-Ast#Message).\n\n@docs parse, deadEndsToString\n\n","unions":[],"aliases":[],"values":[{"name":"deadEndsToString","comment":" Render parser errors as a human-readable string.\n","type":"List.List Parser.DeadEnd -> String.String"},{"name":"parse","comment":" Parse an ICU message string.\n\n    parse \"Hello, {name}!\"\n    --> Ok [ Literal \"Hello, \", Argument \"name\", Literal \"!\" ]\n\n","type":"String.String -> Result.Result (List.List Parser.DeadEnd) Icu.Ast.Message"}],"binops":[]},{"name":"Icu.Value","comment":" A runtime argument value substituted into a message.\n\n@docs Value\n@docs toDisplayString\n\n","unions":[{"name":"Value","comment":" The value bound to a placeholder when formatting a message.\n\n  - `Str` — for `{name}` and `select` arguments.\n  - `Int` / `Float` — for `number`, `plural`, and `selectordinal` arguments.\n  - `Time` — for `date` and `time` arguments.\n\n","args":[],"cases":[["Str",["String.String"]],["Int",["Basics.Int"]],["Float",["Basics.Float"]],["Time",["Time.Posix"]]]}],"aliases":[],"values":[{"name":"toDisplayString","comment":" A best-effort plain-string rendering, used when a value is substituted for a\nbare `{name}` placeholder (no type/format). Numbers are rendered without locale\nformatting; use a `number` placeholder for that. Times render as their epoch\nmilliseconds, which is rarely what you want — prefer a `date`/`time`\nplaceholder.\n","type":"Icu.Value.Value -> String.String"}],"binops":[]}]