-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | GNU Gettext-based messages localization library -- -- More or less fully functional translation framework, based on -- haskell-gettext and text-format-heavy packages. @package localize @version 0.2.0.1 -- | This module contains data type definitions for the localize -- package. module Text.Localize.Types -- | Language identifier type LanguageId = String -- | Context name type Context = ByteString -- | String to be translated type TranslationSource = ByteString -- | Stores translation catalogs for all supported languages data Translations Translations :: Map LanguageId Catalog -> Translations [tMap] :: Translations -> Map LanguageId Catalog -- | 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. class (Monad m, Applicative m) => Localized m -- | Obtain currently selected language ID. getLanguage :: Localized m => m LanguageId -- | Obtain currently loaded translations. getTranslations :: Localized m => m Translations -- | Obtain currently selected localization context. Nothing means no -- specific context. getContext :: Localized m => m (Maybe Context) -- | This assumes UTF-8 encoding. toText :: TranslationSource -> Text instance GHC.Show.Show Text.Localize.Types.Translations -- | This module offers a simple implementation of Localized class -- via StateT transformer. This implementation is usable if you -- have nothing against adding yet another transformer to your already -- complicated monadic stack. Otherwise, it may be simpler for you to add -- necessary fields to one of StateTs or ReaderTs in -- your stack. module Text.Localize.State -- | Localization state data LocState LocState :: Translations -> LanguageId -> Maybe Context -> LocState [lsTranslations] :: LocState -> Translations [lsLanguage] :: LocState -> LanguageId [lsContext] :: LocState -> Maybe Context -- | Localization monad transformer newtype LocalizeT m a LocalizeT :: StateT LocState m a -> LocalizeT m a [unLocalizeT] :: LocalizeT m a -> StateT LocState m a -- | Run a computation inside LocalizeT. runLocalizeT :: Monad m => LocalizeT m a -> LocState -> m a -- | Set current language setLanguage :: Monad m => LanguageId -> LocalizeT m () -- | Execute some actions with specified language. withLanguage :: Monad m => LanguageId -> LocalizeT m a -> LocalizeT m a -- | Set current context. setContext :: Monad m => Maybe Context -> LocalizeT m () -- | Execute some actions within specific context. withContext :: Monad m => Maybe Context -> LocalizeT m a -> LocalizeT m a instance GHC.Show.Show Text.Localize.State.LocState instance GHC.Base.Monad m => Control.Monad.State.Class.MonadState Text.Localize.State.LocState (Text.Localize.State.LocalizeT m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Text.Localize.State.LocalizeT m) instance GHC.Base.Monad m => GHC.Base.Monad (Text.Localize.State.LocalizeT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Text.Localize.State.LocalizeT m) instance GHC.Base.Functor m => GHC.Base.Functor (Text.Localize.State.LocalizeT m) instance GHC.Base.Monad m => Text.Localize.Types.Localized (Text.Localize.State.LocalizeT m) -- | This module contains definitions related to obtaining current -- localization settings from process's locale. module Text.Localize.Locale -- | Obtain language to be used from process's locale. languageFromLocale :: IO LanguageId -- | This module contains definitions for loading translation catalogs. module Text.Localize.Load -- | This data type defines where to search for catalog files (.mo -- or .gmo) in the file system. data LocatePolicy LocatePolicy :: [FilePath] -> String -> Facet -> Format -> LocatePolicy -- | Paths to directory with translations, e.g. -- "/usr/share/locale". Defaults to "locale". [lcBasePaths] :: LocatePolicy -> [FilePath] -- | Catalog file name (in gettext this is also known as text domain). -- Defaults to "messages". [lcName] :: LocatePolicy -> String -- | Locale facet. Defaults to LC_MESSAGES. [lcFacet] :: LocatePolicy -> Facet -- | File path format. The following variables can be used: -- --