packages feed

lhae-0.0.2: src/I18n.hs

module I18n (__,initI18n)
    where

import Text.I18N.GetText (getText,bindTextDomain,textDomain)
import System.Locale.SetLocale (setLocale,Category(LC_ALL))
import System.IO.Unsafe (unsafePerformIO)
import Codec.Binary.UTF8.String (decodeString)

__ :: String -> String
__ = decodeString . unsafePerformIO . getText

initI18n :: String -> IO ()
initI18n locale = do
  setLocale LC_ALL $ Just locale
  bindTextDomain __MESSAGE_CATALOG_DOMAIN__  $ Just __MESSAGE_CATALOG_DIR__
  textDomain $ Just __MESSAGE_CATALOG_DOMAIN__ 
  return ()