Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/engagesoftware/elm-dnn-localization
Helpers for working with DNN localization in Elm
https://github.com/engagesoftware/elm-dnn-localization
Last synced: about 1 month ago
JSON representation
Helpers for working with DNN localization in Elm
- Host: GitHub
- URL: https://github.com/engagesoftware/elm-dnn-localization
- Owner: EngageSoftware
- License: apache-2.0
- Created: 2018-01-11T20:48:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-01T12:57:44.000Z (about 2 months ago)
- Last Synced: 2024-11-01T13:35:44.409Z (about 2 months ago)
- Language: Elm
- Homepage: http://package.elm-lang.org/packages/engagesoftware/elm-dnn-localization/latest
- Size: 80.1 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-dnn-localization
Helpers for working with Engage's DNN localization.
To get started, decode an array of objects into a `Localization` value (which is just an alias for `Dict String String`).
```elm
import Dict
import Engage.Localization as Localization exposing (Localization)
import Json.Decode as DecodelocalizationJson : String
localizationJson = """
[
{ "key": "FirstName.Text", "value": "First Name:" },
{ "key": "LastName.Text", "value": "Last Name:" }
]
"""myLocalization : Localization
myLocalization =
case localizationJson |> Decode.decodeString Localization.decoder of
Ok localization ->
localization
Err _ ->
Dict.emptytype alias MyModel =
{ localization: Localization
}myModel : MyModel
myModel = MyModel myLocalizationLocalization.localizeString "FirstName.Text" myModel
--> "First Name:"
```