Macromedia dreamweaver 8-extending dreamweaver Manuel D’Utilisation
Localizing an extension
107
Dreamweaver supports the use of event handlers within links. Event handlers in links must
use syntax, as shown in the following example:
use syntax, as shown in the following example:
<a href=”#” onMouseDown=alert(‘hi’)>link text</a>
Plug-ins (set to
play
at all times) are supported in the
BODY
of extensions. The
document.write()
statement, Java applets, and ActiveX controls are not supported
in extensions.
Displaying Help
The
displayHelp()
function, which is part of several extension APIs, causes Dreamweaver to
do the following two things when you include it in your extension:
■
Add a Help button to the interface.
■
Call
displayHelp()
when the user clicks the Help button.
You must write the body of the
displayHelp()
function to display Help. How you code the
displayHelp()
function determines how your extension displays Help. You can call the
dreamweaver.browseDocument()
function to open a file in a browser or devise a custom way
to display Help such as displaying messages in another layer in alert boxes.
The following example uses the
displayHelp()
function to display Help by calling
dreamweaver.browseDocument()
:
// The following instance of displayHelp() opens a browser to display a file
// that explains how to use the extension.
function displayHelp() {
// that explains how to use the extension.
function displayHelp() {
var myHelpFile = dw.getConfigurationPath() + "ExtensionsHelp/
myExtHelp.htm";
dw.browseDocument(myHelpFile);
myExtHelp.htm";
dw.browseDocument(myHelpFile);
}
Localizing an extension
Use the following techniques to make it easier to translate your extensions into local
languages.
languages.
■
Separate extensions into HTML and JavaScript files. The HTML files can be replicated
and localized; the JavaScript files are not localized.
and localized; the JavaScript files are not localized.
■
Do not define display strings in the JavaScript files (check for alerts and UI code). Extract
all localizable strings into separate XML files in the Dreamweaver Configuration/Strings
folder.
all localizable strings into separate XML files in the Dreamweaver Configuration/Strings
folder.