getTranslatorInfo()
Description
This function provides information about the translator and the files it can affect.
Arguments
None.
Returns
An array of strings. The elements of the array must appear in the following order:
- The
translatorClassstring uniquely identifies the translator. This string must begin with a letter and can contain only alphanumeric characters, hyphens (-), and underscores (_). - The
titlestring describes the translator in no more than 40 characters. - The
nExtensionsstring specifies the number of file extensions to follow. IfnExtensionsis zero, the translator can run on any file. IfnExtensionsis zero,nRegExpsis the next element in the array. - The
extensionstring specifies a file extension (for example,"htm"or"SHTML") that works with this translator. This string is not case-sensitive and should not contain a leading period. The array should contain the same number ofextensionelements that are specified innExtensions. - The
nRegExpsstring specifies the number of regular expressions that follow. IfnRegExpsis zero,runDefaultis the next element in the array. - The
regExpsstring specifies a regular expression that you can check. The array should contain the same number ofregExpselements as are specified innRegExps, and at least one of theregExpselements must match a piece of the document's source code before the translator can act on a file. - The
runDefaultstring specifies when this translator executes. The following list gives the possible string values:String
Definition
"allFiles"
Sets the translator to always execute.
"noFiles"
Sets the translator to never execute.
"byExtension"
Sets the translator to execute for files that have one of the file extensions that are specified in the extension.
"byExpression"
Sets the translator to execute if the document contains a match for one of the specified regular expressions.
"bystring"
Sets the translator to execute if the document contains a match for one of the specified strings.
NOTE
If you set
runDefaultto"byExtension"but do not specify any extensions (see step 4.), the effect is the same as setting"allFiles". If you setrunDefaultto"byExpression"but do not specify any expressions (see step 6.), the effect is the same as setting"noFiles". - The
prioritystring specifies the default priority for running this translator. The priority is a number between0and100. If you do not specify a priority, the default priority is100. The highest priority is0, and100is the lowest. When multiple translators apply to a document, this setting controls the order in which the translators are applied. The highest priority is applied first. When multiple translators have the same priority, they are applied in alphabetical order bytranslatorClass.
Example
The following instance of the getTranslatorInfo() function gives information about a translator for server-side includes:
function getTranslatorInfo(){ var transArray = new Array(11); transArray[0] = "SSI"; transArray[1] = "Server-Side Includes"; transArray[2] = "4"; transArray[3] = "htm"; transArray[4] = "stm"; transArray[5] = "html"; transArray[6] = "shtml"; transArray[7] = "2"; transArray[8] = "<!--#include file"; transArray[9] = "<!--#include virtual"; transArray[10] = "byExtension"; transArray[11] = "50"; return transArray;}