This library extends the Distribution with internationalization support.
It performs two functions:
- compiles and installs PO files to the specified directory
- tells the application where files were installed to make it able to bind them to the code
Each PO file will be placed to the
prefix/sharebut could be different, depends on system.
- Locale name (language code, two characters). This module
supposes, that each PO file has a base name set to the proper
de.pois the German translation of the program, so this file will be placed under
- Program domain. A unique identifier of single
translational unit (program). By default domain will be set to the
package name, but its name could be configured in the
The module defines following
- Name of the domain. One ofmore alphanumeric characters separated by hyphens or underlines. When not set, package name will be used.
- List of files with translations. Could be
used a limited form of wildcards, e.g.:
- Name of the macro, in which domain name
will be passed to the program. Default value is
- Name of the macro, in which path to the
message catalog will be passed to the program. Default value is
The last two parameters are used to send configuration data to the code during its compilation. The most common usage example is:
... prepareI18N = do setLocale LC_ALL (Just "") bindTextDomain __MESSAGE_CATALOG_DOMAIN__ (Just __MESSAGE_CATALOG_DIR__) textDomain __MESSAGE_CATALOG_DOMAIN__ main = do prepareI18N ... ...
NOTE: files, passed in the
x-gettext-po-files are not
automatically added to the source distribution, so they should be
also added to the
extra-source-files parameter, along with
translation template file (usually
WARNING: sometimes, when only configuration targets changes, code
will not recompile, thus you should execute
cabal clean to
cleanup the build and restart it again from the configuration. This
is temporary bug, it will be fixed in next releases.
Installs hooks, used by GetText module to install PO files to the system. Previous won't be disabled