driebit / elm-ginger / Ginger.Translation

Definitions


type Translation


type Language
    = AR
    | DE
    | EN
    | ES
    | ET
    | FR
    | ID
    | NL
    | PL
    | RU
    | SR
    | TR
    | ZH
    | Custom String

Construct

empty : Translation

An empty 'Translation'

fromList : List ( Language, String ) -> Translation

Construct a Translation from a list of Language and String value pairs

Empty Strings will be ignored

Convert

toString : Language -> Translation -> String

Get the translated String value.

Unescapes character entity references, strips Html nodes and defaults to an empty String.

toStringEscaped : Language -> Translation -> String

Get the original translated String value as returned by the REST api.

Defaults to an empty String.

toNodes : Language -> Translation -> List Html.Parser.Node

Get translated String as hecrj/html-parser Nodes

Defaults to an empty List if parsing fails.

withDefault : Language -> Language -> Translation -> String

Get the translated String value.

The first argument is the fallback Language.

Attempt fallback if translated value is missing, defaults to an empty String.

toIso639 : Language -> String

Convert a Language to an Iso639 String

isEmpty : Language -> Translation -> Basics.Bool

Checks if translated String is empty.

Render as Html

text : Language -> Translation -> Html msg

Translate and render as Html text

We try to unescape the escaped characters but if that fails we'll render the Translation as is.

Html elements will be filtered out and the text will be concatenated.

html : Language -> Translation -> List (Html msg)

Translate and render as Html markup

Render in language

textNL : Translation -> Html msg

Translate to Dutch and render as Html text

htmlNL : Translation -> List (Html msg)

Translate to Dutch and render as Html markup

textEN : Translation -> Html msg

Translate to English and render as Html text

htmlEN : Translation -> List (Html msg)

Translate to English and render as Html markup

Decode

fromJson : Json.Decode.Decoder Translation