localize-0.2.0.0: GNU Gettext-based messages localization library

Safe HaskellNone
LanguageHaskell2010

Text.Localize.IO

Contents

Description

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.

Synopsis

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.

setContext :: Maybe Context -> IO () Source #

Set current context.

withContext :: Maybe Context -> IO a -> IO a Source #

Execute some actions within specific context, and then return to previously used context.

Orphan instances