Creating a Language Catalog File
A language catalog (.cat) file contains the XML that defines the text strings as key name/value pairs within a single <IDLffLangCat> tag. The tag can contain four optional attributes, as described in Table 19-1.
Note
You cannot perform queries on VERSION, DATE, and AUTHOR. These attributes are more like XML comments on the tag; they are informational only.
Note
For more information on XML, see About XML.
The following XML snippet, extracted from the iTools menu catalog file that comes with the IDL installation, illustrates the basic file structure:
<IDLffLangCat APPLICATION="itools menu" VERSION="1.0" AUTHOR="ITT"> <LANGUAGE NAME="English"> <KEY NAME="Menu:File">File</KEY> <KEY NAME="Menu:File:New">New</KEY> <KEY NAME="Menu:File:Open">Open...</KEY> </LANGUAGE> </IDLffLangCat>
The <IDLffLangCat> tag can contain any number of LANGUAGE tags. Each LANGUAGE tag must have a NAME attribute denoting the language contained therein.
Each LANGUAGE tag can contain any number of KEY tags. Each KEY tag must have a NAME attribute denoting the name of the key.
Note
All text between the open and close KEY tags will be part of the string returned by the query, including any line feeds, carriage returns, and spaces.
The catalog file can contain keys for one or more languages. Whether there is a single catalog file containing multiple languages, or multiple catalog files, each containing a single language, is personal preference.
By keeping each language separate in the tag definition, you can easily cut and paste an entire block and then change the strings of one language to another language while keeping all the keys intact. This technique also allows for the possibility of having different languages in separate files. Note that the keys in any one language need not match those of another language (although in most cases they will).
Note
IDL supports catalog files written in 8-bit strings (which can be encoded for languages using special marks; see below). Also, you must have the corresponding fonts installed on your machine before you can use a particular language.
Note
If your language has accent marks such as those in French, you might need to modify the catalog file to support those encodings. In general, you should use the encoding appropriate for your catalog's language. For more information, see "IDLffLangCat" (IDL Reference Guide).
Storing and Loading Language Catalog Files
The catalog files included with IDL are in the /resource/langcat directory of the IDL installation and end in a.cat extension. These files contain the English keys for iTools menus, dialogs, and messages and are provided to support the use of applications using iTools functionality in other languages. All catalog files must end with the .cat extension if APP_NAME is used to locate the files.
You can create custom catalog files and place them in a location of your choice. You typically use a full path to access these catalog files through the creation of an IDLffLangCat object (see Using the IDLffLangCat Class for more information).
You can specify a catalog either by giving the full path of the catalog file or files, or by providing an application name or names and, optionally, an application path or paths. If no path is specified, only the current directory is searched. For all application paths, all .cat files found in any of the directories listed are searched for all given applications.
On a similar note, if IDL finds a duplicate key name while loading keys, IDL will use the string corresponding to the last key found with the given name.