Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module is most near to be a drop-in replacement for hgettext
API.
It provides an instance Localized IO
by using process-level global variables (IORefs) for
storing current language and translations.
Being mostly an example, this module can though be usable for relatively simple applications, for which you do not need to change languages a lot.
- setupTranslations :: LocatePolicy -> IO ()
- setLanguage :: LanguageId -> IO ()
- withLanguage :: LanguageId -> IO a -> IO a
- setContext :: Maybe Context -> IO ()
- withContext :: Maybe Context -> IO a -> IO a
Documentation
setupTranslations :: LocatePolicy -> IO () Source #
This function must be called before any translation function call, otherwise you will get runtime error.
Current language is selected from process locale at startup. You can
change it later by calling setLanguage
or withLanguage
.
setLanguage :: LanguageId -> IO () Source #
Set current language.
withLanguage :: LanguageId -> IO a -> IO a Source #
Execute some actions with specific language, and then return to previously used language.
withContext :: Maybe Context -> IO a -> IO a Source #
Execute some actions within specific context, and then return to previously used context.