Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Text.I18N.GetText
Description
This library provides basic internationalization capabilities
Synopsis
- getText :: String -> IO String
- nGetText :: String -> String -> Integer -> IO String
- dGetText :: Maybe String -> String -> IO String
- dnGetText :: Maybe String -> String -> String -> Integer -> IO String
- dcGetText :: Maybe String -> Category -> String -> IO String
- dcnGetText :: Maybe String -> Category -> String -> String -> Integer -> IO String
- bindTextDomain :: String -> Maybe String -> IO String
- bindTextDomainCodeset :: String -> Maybe String -> IO (Maybe String)
- textDomain :: Maybe String -> IO String
Documentation
getText :: String -> IO String Source #
getText
wraps GNU gettext@ function. It returns translated string for the
input messages. If translated string not found the input string will be
returned.
The most common usage of this function is to declare function __
:
__ = unsafePerformIO . getText
and wrap all text strings into this function, e.g.
printHello = putStrLn (__ "Hello")
Arguments
:: String | msgid in singular form |
-> String | msgid in plural form |
-> Integer | number, used to choose appropriate form |
-> IO String | result string, by default if number is 1 than singular form of msgid is returned, otherwise --- plural |
nGetText
wraps GNU ngettext function. It translates text string in the
user's native language, by lookilng up the approppiate plural form of the
message.
Arguments
:: Maybe String | domain name, if |
-> String | message id |
-> IO String | return value |
Arguments
:: Maybe String | domain name, if |
-> String | msgid in singular form |
-> String | msgid in plural form |
-> Integer | number, used to choose appropriate form |
-> IO String | result string, by default if number is 1 than singular form of msgid is returned, otherwise --- plural |
Arguments
:: Maybe String | domain name, if |
-> Category | locale facet |
-> String | message id |
-> IO String | return value |
Arguments
:: Maybe String | domain name, if |
-> Category | locale facet |
-> String | msgid in singular form |
-> String | msgid in plural form |
-> Integer | number, used to choose appropriate form |
-> IO String | result string, by default if number is 1 than singular form of msgid is returned, otherwise --- plural |
dcnGetText
wraps GNU dcngettext function. It works similar to dnGetText
but
also takes category id
Arguments
:: String | domain name |
-> Maybe String | path to the locale folder or |
-> IO String | return value |
bindTextDomain
sets the base directory of the hierarchy
containing message catalogs for a given message domain.
Throws IOError
if fails
bindTextDomainCodeset Source #
Arguments
:: String | domain name |
-> Maybe String | locale codeset or |
-> IO (Maybe String) | return value |
bindTextDomainCodeset
sets domain codeset for future getText
call
Arguments
:: Maybe String | domain name, if |
-> IO String | return value |
textDomain
sets domain for future getText
call
Throws IOError
if fails