This library provides basic internationalization capabilities
- 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 (Maybe String)
- textDomain :: Maybe String -> IO (Maybe String)
Documentation
getText :: String -> IO StringSource
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")
:: 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.
:: Maybe String | domain name, if |
-> String | message id |
-> IO String | return value |
dGetText wraps GNU dgettext function. It works similar to getText
but also could take domain name.
:: 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 |
dnGetText wraps GNU dngettext function. It works similar to nGetText
but
also takes domain name
:: Maybe String | domain name, if |
-> Category | locale facet |
-> String | message id |
-> IO String | return value |
dcGetText wraps GNU dcgettext function. It works similar to dGetText
but also takes category id
:: 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