andreasewering/intl-proxy/1.0.0

NOTE: the latest version is 2.0.1

Renamed to anmolitor/intl-proxy. It is published under that name, and new versions come out there.

Versions published as andreasewering/intl-proxy still install under that name. 4 versions of 5 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/anmolitor/intl-proxy.

What we checked: The repo moved to github.com/anmolitor/intl-proxy. Rebuilt with git archive from commit 755886360019 of https://github.com/anmolitor/intl-proxy (zip prefix andreasewering-intl-proxy-7558863/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 a3d47ca0fbe6062b44a72ac2e0b95e56dfc9998b.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/andreasewering/intl-proxy/zipball/1.0.0/

Intl

CodeGen for Intl functions. The Intl API will be given access to by a Proxy Object injected into the Elm Runtime via Flags. This mechanism makes it possible to have synchronous communication with JS. In order to avoid a lot of methods on the JS side, we are using a eval-like mechanism: We pass the information which Sub API to call and with which arguments as a JSON string.

type alias Intl =
Value

Use this type for the JS Proxy Object you received via a flag or a port from the accompanying JS package.

decode : Decoder Intl

Convienience decoder for Intl Type. This makes it possible for me to change the internal representation without a breaking change.

type alias PluralOptions number =
{ language : String
, type_ : PluralType
, number : number
}

Options for the plural function.

plural : Intl -> PluralOptions Int -> String

Determine the CLDR plural category (see https://www.unicode.org/cldr/cldr-aux/charts/30/supplemental/language_plural_rules.html) for a given number and language.

The possible categories are: zero, one, two, few, many, and other. When the category cannot be determined for whatever reason, this function will default to "other".

type alias FormatNumberOptions number =
{ language : String
, args : List ( String, Value )
, number : number
}

Options for the formatInt and formatFloat functions.

args can consist of any object entries you want to pass to the NumberFormat constructor. The following serves as a hint to what is actually valid and will not result in an error:

- currency: String, needs to be set if style is "currency". For example "EUR" is a valid currency.
- currencyDisplay: "name", "symbol" or "code", defaults to "symbol"
- maximumFractionDigits: Int
- maximumSignificantDigits: Int
- minimumFractionDigits: Int
- minimumIntegerDigits: Int
- minimumSignificantDigits: Int
- style : one of "decimal", "currency", "percent"
- useGrouping : Bool, True results in something like 123.456.789 while False will result in 123456789
formatFloat : Intl -> FormatNumberOptions Float -> String

Format a Float with the given Options

formatInt : Intl -> FormatNumberOptions Int -> String

Format an Int with the given Options