| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Fluent.Translate
Documentation
A target message or attribute lookup. Also carries accumulated variadic parameters.
Constructors
| Reference | |
Instances
| IsString Reference Source # | Express a
|
Defined in Language.Fluent.Translate Methods fromString :: String -> Reference # | |
class Translate r where Source #
Brings together a message reference, any number of arguments, and a bundle to form a complete translation.
Instances of this class address three orthogonal concerns:
- Argument collection. Messages may require arguments before they can be translated. These arguments may be passed directly or resolved implicitly from context.
- Bundle resolution. Ultimately all translations come from a bundle. This bundle may be passed directly or resolved implicitly from context.
- Return type. Determines a translation's output structure and its failure semantics.
Examples:
-- Explicit bundle with arguments, returning an Either for safe error handling.
result :: Either String Text
result = translate "welcome" ("name", "Alice") bundle-- Rendering directly to a Miso View, which provides the bundle through the Context. view :: View Context props model action view = translate "title"
Instances
| Locale locale => Translate (Bundle locale -> Either String Text) Source # | |
| Translate r => Translate (Override -> r) Source # | |
| (k ~ Text, ToValue v, Translate r) => Translate ((k, v) -> r) Source # | |
Defined in Language.Fluent.Translate | |
| (Foldable f, k ~ Text, ToValue v, Translate r) => Translate (f (k, v) -> r) Source # | |
Defined in Language.Fluent.Translate | |