Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains data type definitions for the localize
package.
- type LanguageId = String
- type Context = ByteString
- type TranslationSource = ByteString
- data Translations = Translations {
- tMap :: Map LanguageId Catalog
- class (Monad m, Applicative m) => Localized m where
- toText :: TranslationSource -> Text
Documentation
type LanguageId = String Source #
Language identifier
type Context = ByteString Source #
Context name
type TranslationSource = ByteString Source #
String to be translated
data Translations Source #
Stores translation catalogs for all supported languages
class (Monad m, Applicative m) => Localized m where Source #
This is the main type class of the package. All functions work with any instance of this type class.
Note that this class only supports **getting** current language
and translation, not setting them. Though concrete implementation
can have its own ways to change language or context, these ways are
not required by the localize
package, and so are not declared in the
type class.
getLanguage :: m LanguageId Source #
Obtain currently selected language ID.
getTranslations :: m Translations Source #
Obtain currently loaded translations.
getContext :: m (Maybe Context) Source #
Obtain currently selected localization context. Nothing means no specific context.
toText :: TranslationSource -> Text Source #
This assumes UTF-8 encoding.