User Guide

Determining what kind of translator to use 339
Arguments
docName
, siteRoot, docContent
The docName argument is a string that contains the file:// URL for the document to
be translated.
The siteRoot argument is a string that contains the file:// URL for the root of the site that
contains the document to be translated. If the document is outside a site, this string might be
empty.
The docContent argument is a string that contains the contents of the document.
Returns
A string that contains the translated document or an empty string if nothing is translated.
Example
The following instance of the liveDataTranslateMarkup() function calls the C function
translateASP(), which is contained in a DLL (Windows) or a code library (Macintosh)
called ASPTrans:
function liveDataTranslateMarkup(docName, siteRoot, docContent){
var translatedString = "";
if (docContent.length > 0){
translatedString = ASPTrans.translateASP(docName, siteRoot, docContent);
}
return translatedString;
}
Determining what kind of translator to use
All translators must contain the getTranslatorInfo() and translateMarkup() functions, and
they must reside in the Configuration/Translators folder. They differ, however, in the kind of code
that they insert into the user’s document and in how that code must be inspected, as described in
the following list:
To translate small pieces of server markup that determine attribute values or that conditionally
add attributes to a standard HTML tag, write an attribute translator. Standard HTML tags
that contain translated attributes can be inspected with the Property inspectors that are built
into Dreamweaver. It is not necessary to write a custom Property inspector (see Adding a
translated attribute to a tag” on page 340).
To translate an entire tag (for example, a server-side include) or a block of code (for example,
JavaScript, ColdFusion, PHP, or other scripting), write a block/tag translator. The code that is
generated by a block/tag translator cannot be inspected with the Property inspectors that are
built into Dreamweaver. You must write a custom Property inspector for the translated content
if you want users to be able to change the properties of the original code (see “Locking
translated tags or blocks of code” on page 345).