Next: , Previous: , Up: I18N Level 3   [Contents][Index]


64.2.4 Domain Specification

The default message domain of SXEmacs 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 Form: defvar symbol [value [doc-string [domain]]]

Example:

(defvar weight 250 "Weight of gorilla, in pounds." "emacs-gorilla")
Special Form: 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")