i18n-0.4.0.0: Internationalization for Haskell

Copyright(c) 2011-2016 Eugene Grigoriev
LicenseBSD3
MaintainerPhilip Cunningham <hello@filib.io>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Text.I18n

Contents

Description

Internationalisation support for Haskell.

Synopsis

Internationalisation Monad Functions

gettext :: Text -> I18n Text Source

localize Source

Arguments

:: 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."

withContext Source

Arguments

:: 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."

withLocale Source

Arguments

:: 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