rakutentech / r10 / R10.I18n

Internationalization stuff

t : R10.Language.Language -> R10.Language.Translations -> String

Translate some text

replace : List ( String, String ) -> String -> String

Utility for variable replacement in translation.

raw : String
raw =
    "Hello my name is '{firstName}, {lastName}'"

result =
    raw
        |> R10.I18n.replace [ ( "{firstName}", "foo" ), ( "{lastName}", "bar" ) ]

-- result == "Hello my name is 'foo, bar'"

text : R10.Language.Translations -> Element.WithContext.Element (R10.Context.ContextInternal z) msg

Shorthand to transform a translation into an Element.text

paragraph : List (Element.WithContext.Attribute (R10.Context.ContextInternal z) msg) -> { renderingMode : RenderingMode, tagReplacer : R10.Context.ContextInternal z -> String -> String, translation : R10.Language.Translations } -> Element.WithContext.Element (R10.Context.ContextInternal z) msg


type RenderingMode
    = Normal
    | Error

paragraphFromString : List (Element.WithContext.Attribute (R10.Context.ContextInternal z) msg) -> { renderingMode : RenderingMode, tagReplacer : R10.Context.ContextInternal z -> String -> String, string : String, msgNoOp : Maybe msg } -> Element.WithContext.Element (R10.Context.ContextInternal z) msg