hgettext-0.1.31.0: Bindings to libintl.h (gettext, bindtextdomain)

Safe HaskellSafe
LanguageHaskell2010

Text.I18N.GetText

Description

This library provides basic internationalization capabilities

Synopsis

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")

nGetText Source #

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.

dGetText Source #

Arguments

:: Maybe String

domain name, if Nothing --- default domain will be used

-> String

message id

-> IO String

return value

dGetText wraps GNU dgettext function. It works similar to getText but also could take domain name.

dnGetText Source #

Arguments

:: Maybe String

domain name, if Nothing --- default domain will be used

-> 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

dcGetText Source #

Arguments

:: Maybe String

domain name, if Nothing --- default domain will be used

-> 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

dcnGetText Source #

Arguments

:: Maybe String

domain name, if Nothing --- default domain will be used

-> 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

bindTextDomain Source #

Arguments

:: String

domain name

-> Maybe String

path to the locale folder or Nothing to return base directory for domain

-> IO String

return value

bindTextDomain sets the base directory of the hierarchy containing message catalogs for a given message domain.

Throws IOError if fails

textDomain Source #

Arguments

:: Maybe String

domain name, if Nothing than returns current domain name

-> IO String

return value

textDomain sets domain for future getText call

Throws IOError if fails