[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

62. Internationalization


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

62.1 I18N Levels 1 and 2

XEmacs is now compliant with I18N levels 1 and 2. Specifically, this means that it is 8-bit clean and correctly handles time and date functions. XEmacs will correctly display the entire ISO-Latin 1 character set.

The compose key may now be used to create any character in the ISO-Latin 1 character set not directly available via the keyboard.. In order for the compose key to work it is necessary to load the file ‘x-compose.el’. At any time while composing a character, C-h will display all valid completions and the character which would be produced.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

62.2 I18N Level 3


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

62.2.1 Level 3 Basics

XEmacs now provides alpha-level functionality for I18N Level 3. This means that everything necessary for full messaging is available, but not every file has been converted.

The two message files which have been created are ‘src/emacs.po’ and ‘lisp/packages/mh-e.po’. Both files need to be converted using msgfmt, and the resulting ‘.mo’ files placed in some locale’s LC_MESSAGES directory. The test “translations” in these files are the original messages prefixed by TRNSLT_.

The domain for a variable is stored on the variable’s property list under the property name variable-domain. The function documentation-property uses this information when translating a variable’s documentation.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

62.2.2 Level 3 Primitives

Function: gettext string

This function looks up string in the default message domain and returns its translation. If I18N3 was not enabled when XEmacs was compiled, it just returns string.

Function: dgettext domain string

This function looks up string in the specified message domain and returns its translation. If I18N3 was not enabled when XEmacs was compiled, it just returns string.

Function: bind-text-domain domain pathname

This function associates a pathname with a message domain. Here’s how the path to message file is constructed under SunOS 5.x:

 
{pathname}/{LANG}/LC_MESSAGES/{domain}.mo

If I18N3 was not enabled when XEmacs was compiled, this function does nothing.

Macro: domain string

This macro specifies the text domain used for translating documentation strings and interactive prompts of a function. For example, write:

 
(defun foo (arg) "Doc string" (domain "emacs-foo") …)

to specify emacs-foo as the text domain of the function foo. The “call” to domain is actually a declaration rather than a function; when actually called, domain just returns nil.

Function: domain-of function

This function returns the text domain of function; it returns nil if it is the default domain. If I18N3 was not enabled when XEmacs was compiled, it always returns nil.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

62.2.3 Dynamic Messaging

The format function has been extended to permit you to change the order of parameter insertion. For example, the conversion format %1$s inserts parameter one as a string, while %2$s inserts parameter two. This is useful when creating translations which require you to change the word order.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

62.2.4 Domain Specification

The default message domain of XEmacs is ‘emacs’. For add-on packages, it is best to use a different domain. For example, let us say we want to convert the “gorilla” package to use the domain ‘emacs-gorilla’. To translate the message “What gorilla?”, use dgettext as follows:

 
(dgettext "emacs-gorilla" "What gorilla?")

A function (or macro) which has a documentation string or an interactive prompt needs to be associated with the domain in order for the documentation or prompt to be translated. This is done with the domain special form as follows:

 
(defun scratch (location)
  "Scratch the specified location."
  (domain "emacs-gorilla")
  (interactive "sScratch: ")
  … )

It is most efficient to specify the domain in the first line of the function body, before the interactive form.

For variables and constants which have documentation strings, specify the domain after the documentation.

Special Operator: defvar symbol [value [doc-string [domain]]]

Example:

 
(defvar weight 250 "Weight of gorilla, in pounds." "emacs-gorilla")
Special Operator: defconst symbol [value [doc-string [domain]]]

Example:

 
(defconst limbs 4 "Number of limbs" "emacs-gorilla")
Function: autoload function filename &optional docstring interactive type

This function defines function to autoload from filename Example:

 
(autoload 'explore "jungle" "Explore the jungle." nil nil "emacs-gorilla")

The Asian-language support in XEmacs is called “MULE”. See section MULE.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Aidan Kehoe on December 27, 2016 using texi2html 1.82.