| Copyright | (c) 2026 Institute for Digital Autonomy |
|---|---|
| License | EUPL-1.2 |
| Maintainer | IDA |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
Language.Fluent
Description
Project Fluent is a localisation system designed to unleash the entire expressive power of natural language translations.
This library provides the core Fluent translation machinery to go from parsed
Resources to translated messages:
- the
Localetypeclass which supplies locale-specific operations - the
Bundletype which combinesLocales with parsedResources - the
Translatetypeclass which translates messages from aBundle
This library does not provide any concrete instances of Locale.
It is not intended to be used directly for translating messages.
Applications should instead use a library built on top of this one, such as:
- fluent-icu, backed by text-icu
- miso-fluent,
backed by the browser's
IntlAPI
Synopsis
- data Identifier
- data Resource
- data Bundle locale = Bundle {}
- data Override
- = UseIsolating Bool
- | WithFunction Identifier ([Pattern] -> HashMap Identifier SomeValue -> Either String Pattern)
- bundle :: NonEmpty locale -> [Resource] -> Bundle locale
- module Language.Fluent.Locale
- data Style
- data CurrencyDisplay
- data NumberOptions = NumberOptions {}
- numberOptions :: NumberOptions
- parseResource :: Text -> Either String Resource
- newtype Pattern = Pattern (NonEmpty PatternElement)
- data PatternElement
- data Form
- module Language.Fluent.TH
- data Digits
- data TimeOptions = TimeOptions {}
- timeOptions :: TimeOptions
- module Language.Fluent.Translate
- module Language.Fluent.Value
- data Width
Documentation
data Identifier #
Instances
| Show Identifier | |
Defined in Language.Fluent.AST Methods showsPrec :: Int -> Identifier -> ShowS # show :: Identifier -> String # showList :: [Identifier] -> ShowS # | |
| Eq Identifier | |
Defined in Language.Fluent.AST | |
| Ord Identifier | |
Defined in Language.Fluent.AST Methods compare :: Identifier -> Identifier -> Ordering # (<) :: Identifier -> Identifier -> Bool # (<=) :: Identifier -> Identifier -> Bool # (>) :: Identifier -> Identifier -> Bool # (>=) :: Identifier -> Identifier -> Bool # max :: Identifier -> Identifier -> Identifier # min :: Identifier -> Identifier -> Identifier # | |
| Hashable Identifier | |
Defined in Language.Fluent.AST | |
| Lift Identifier | |
Defined in Language.Fluent.TH Methods lift :: Quote m => Identifier -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Identifier -> Code m Identifier # | |
An entire FTL file
Instances
| Generic Resource | |||||
Defined in Language.Fluent.AST Associated Types
| |||||
| Show Resource | |||||
| Eq Resource | |||||
| Lift Resource | |||||
| type Rep Resource | |||||
Defined in Language.Fluent.AST | |||||
A collection of Fluent resources and the configuration needed to resolve and format messages for a locale.
Constructors
| Bundle | |
Fields
| |
Constructors
| UseIsolating Bool | |
| WithFunction Identifier ([Pattern] -> HashMap Identifier SomeValue -> Either String Pattern) |
module Language.Fluent.Locale
What a number denotes, which determines how it is formatted.
data CurrencyDisplay Source #
How a Currency is displayed.
Instances
data NumberOptions Source #
Constructors
| NumberOptions | |
Fields | |
Instances
| Show NumberOptions Source # | |
Defined in Language.Fluent.Number Methods showsPrec :: Int -> NumberOptions -> ShowS # show :: NumberOptions -> String # showList :: [NumberOptions] -> ShowS # | |
| Eq NumberOptions Source # | |
Defined in Language.Fluent.Number Methods (==) :: NumberOptions -> NumberOptions -> Bool # (/=) :: NumberOptions -> NumberOptions -> Bool # | |
A Pattern with all the selections and interpolations resolved down to
SomeValue and isolation marks.
Constructors
| Pattern (NonEmpty PatternElement) |
data PatternElement Source #
A single piece of a Pattern.
Constructors
| Value SomeValue | A value, ready to be formatted. |
| Isolated Pattern | A sequence of values surrounded by isolation marks (FSI, PDI). |
Instances
| Value PatternElement Source # | |
Defined in Language.Fluent.Pattern | |
| IsString PatternElement Source # | |
Defined in Language.Fluent.Pattern Methods fromString :: String -> PatternElement # | |
| Show PatternElement Source # | |
Defined in Language.Fluent.Pattern Methods showsPrec :: Int -> PatternElement -> ShowS # show :: PatternElement -> String # showList :: [PatternElement] -> ShowS # | |
module Language.Fluent.TH
How many digits a date or time field takes, e.g. the ninth month is
9 when Numeric and 09 when TwoDigit.
data TimeOptions Source #
Constructors
| TimeOptions | |
Instances
| Show TimeOptions Source # | |
Defined in Language.Fluent.Time Methods showsPrec :: Int -> TimeOptions -> ShowS # show :: TimeOptions -> String # showList :: [TimeOptions] -> ShowS # | |
| Eq TimeOptions Source # | |
Defined in Language.Fluent.Time | |
module Language.Fluent.Translate
module Language.Fluent.Value