Next: , Up: Localization   [Contents][Index]


2.29.1 Dictionary

Function: intl:translation-enable

Enable recording of translatable strings.

Function: intl:translation-disable

Disablle recording of translatable strings.

Function: intl:setlocale &optional locale

Sets the locale to the locale specified by locale. If locale is not give or is nil, the locale is determined by look at the environment variables LANGUAGE, LC_ALL, LC_MESSAGES, or LANG. If none of these are set, the locale is unchanged.

The default locale is “C”.

Function: intl:textdomain domain

Set the default domain to the domain specified by domain. Typically, this only needs to be done at the top of each source file. This is used to gettext and ngettext to set the domain for the message string.

Macro: intl:gettext string

Look up the specified string, string, in the current message domain and return its translation.

Function: intl:dgettext domain string

Look up the specified string, string, in the message domain, domain. The translation is returned.

When compiled, this also function also records the string so that an appropriate message template file can be created. (See intl::dump-pot-files.)

Macro: intl:ngettext singular plural n

Look up the singular or plural form of a message in the default domain. The singular form is singular; the plural is plural. The number of items is specified by n in case the correct translation depends on the actual number of items.

Function: intl:dngettext domain singular plural n

Look up the singular or plural form of a message in the specified domain, domain. The singular form is singular; the plural is plural. The number of items is specified by n in case the correct translation depends on the actual number of items.

When compiled, this also function also records the singular and plural forms so that an appropriate message template file can be created. (See intl::dump-pot-files.)

Function: intl::dump-pot-files &key :copyright :output-directory

Dumps the translatable strings recorded by dgettext and dngettext. The message template file (pot file) is written to a file in the directory specified by output-directory, and the name of the file is the domain of the string.

If copyright is specified, this is placed in the output file as the copyright message.

Variable: intl:*locale-directories*

This is a list of directory pathnames where the translations can be found.

Function: intl:install &optional (rt *readtable*)

Installs reader macros and comment reader into the specified readtable as explained below. The readtable defaults to *readtable*.

Two reader macros are also provided: _'' and _N''. The first is equivalent to wrapping dgettext around the string. The second returns the string, but also records the string. This is needed when we want to record a docstring for translation or any other string in a place where a macro or function call would be incorrect.

Also, the standard comment reader is extended to allow translator comments to be saved and written to the messages template file so that the translator may not need to look at the original source to understand the string. Any comment line that begins with exactly "TRANSLATORS: " is saved. This means each translator comment must be preceded by this string to be saved; the translator comment ends at the end of each line.


Next: Example Usage, Up: Localization   [Contents][Index]