boianr/multilingual/1.0.0

Multilingual

Display text copy in multiple languages.

Definition

Describe original text copy and available translations.

If translation is not found for given ISO Code output defaults to copy.

type Code
= Bg
| Cs
| Da
| De
| El
| En
| Es
| Et
| Fi
| Fr
| Ga
| He
| Hr
| Hu
| Hy
| It
| Ja
| Ka
| Ko
| Lt
| Lv
| Mt
| Nl
| No
| Pl
| Pt
| Ro
| Ru
| Sk
| Sl
| Sr
| Sv
| Tr
| Uk
| Zh
| Zu

Language Codes according to ISO 639-1

This list is not complete.

Output

print : Code -> Multilingual -> Html Never

Render Multilingual copy to given language code.

Html.p []
    [ Multilingual.print Jp copy
        |> Html.map (always NoOp)
    ]

Above example renders Multilingual copy in Japanese.

Decode

Decode Json data to Multilingual type

Decode.decodeString decode """
            {
                "copy":"Prevedi me",
                "translations": {
                    "en":"Translate me",
                    "fr":"Traduis-moi"
                }
            }
        """