ChristophP/elm-i18next/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

I18Next

This library provides a solution to load and display translations in your app. It allows you to load json translation files, display the text and interpolate placeholders.

Types and Data

type alias Translations =
Translations

A type that represents your loaded translations

initialTranslations : Translations

Use this to initialize Translations in your model.

Using Translations

t : String -> Translations -> String

Translate a value at a given string.

-- Use the key.
t "labels.greetings.hello" translations

Fetching and Deconding

fetchTranslations : (Result Error Translations -> msg) -> String -> Cmd msg

A command to load translation files.

decodeTranslations : Decoder Translations

Decode a JSON translations file.