Copyright | (c) 2011-2016 Eugene Grigoriev |
---|---|
License | BSD3 |
Maintainer | Philip Cunningham <hello@filib.io> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Internationalisation support for Haskell.
Internationalisation Monad Functions
:: L10n | Structure containing localization data |
-> Locale | Locale to use |
-> I18n a | Inernationalized expression |
-> a | Localized expression |
Top level localization function.
Examples:
>>>
I18n.localize l10n (I18n.Locale "cym") example
"Fel dagrau yn y glaw."
When the translation doesn't exist:
>>>
I18n.localize l10n (I18n.Locale "ru") example
"Like tears in rain."
:: Maybe Context | Context to use |
-> I18n a | Internationalized expression |
-> I18n a | New internationalized expression |
Sets a local Context
for an internationalized expression. If there is no translation, then no
context version is tried.
Examples:
>>>
let example2 = I18n.withContext (Just "Attack ships on fire off the shoulder of Orion.") example
>>>
I18n.localize l10n (I18n.Locale "cym") example2
"Fel dagrau yn y glaw."
:: Locale | Locale to use |
-> I18n a | Internationalized expression |
-> I18n a | New internationalized expression. |
Sets a local Locale
for an internationalized expression.
Examples:
>>>
let example3 = I18n.withLocale (I18n.Locale "en") example
>>>
I18n.localize l10n (I18n.Locale "cym") example3
"Like tears in rain."
Re-exports
module Data.Text.I18n.Types