| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Fluent.Locale
Synopsis
- class Locale l where
- fromCode :: Text -> Maybe l
- toCode :: l -> Text
- displayLanguage :: l -> l -> Maybe Text
- localDisplayLanguage :: l -> Maybe Text
- capitalise :: l -> Text -> Text
- pluralCategory :: l -> Scientific -> NumberOptions -> Category
- formatNumber :: NonEmpty l -> Scientific -> NumberOptions -> Either String Text
- formatTime :: NonEmpty l -> UTCTime -> TimeOptions -> Either String Text
Documentation
A locale, identified by an implementation-defined code (e.g. BCP 47, ISO 639).
Minimal complete definition
fromCode, toCode, displayLanguage, capitalise, pluralCategory, formatNumber, formatTime
Methods
fromCode :: Text -> Maybe l Source #
Parse a locale from its textual code, if recognised.
Render a locale back to its textual code.
Translate the name of one language into another.
localDisplayLanguage :: l -> Maybe Text Source #
A language's own name for itself, e.g. Deutsch for German.
capitalise :: l -> Text -> Text Source #
Capitalise the first character of some text following the locale's casing rules.
pluralCategory :: l -> Scientific -> NumberOptions -> Category Source #
Classify a number into a plural category (e.g. "one", "few", "other"), used to pick the matching translation variant.
formatNumber :: NonEmpty l -> Scientific -> NumberOptions -> Either String Text Source #
Format a number according to locale conventions.
formatTime :: NonEmpty l -> UTCTime -> TimeOptions -> Either String Text Source #
Format a point in time according to locale conventions.