beautypg.com

Localizable strings with embedded values, Working with the extension manager, Working with the extension – Adobe Extending Dreamweaver CS4 User Manual

Page 87: Manager

background image

81

EXTENDING DREAMWEAVER CS4

Extending Dreamweaver


do Y!"/>

Don't ever do Z!"/>

Now your JavaScript files can refer to these translatable strings by calling the

dw.loadString()

function, as shown in

the following example:

function initializeUI()

{

...
if (problemYhasOccured)
{

alert(dw.loadString("featureX/subProblemY");

}

}

You can use slash (/) characters in your string identifiers, but do not use spaces. Using slashes, you can create a
hierarchy to suit your needs, and include all the strings in a single XML file.

Note: Files that begin with cc in the Configuration/Strings folder are Contribute files. For example, the file
ccSiteStrings.xml is a Contribute file.

Localizable strings with embedded values

Some display strings have values embedded in them. You can use the

errMsg()

function to display these strings. You

can find the

errMsg()

function, which is similar to the

printf()

function in C, in the string.js file in the

Configuration/Shared/MM/Scripts/CMNfolder. Use the placeholder characters percent sign (

%)

and

s

to indicate

where values should appear in the string and then pass the string and variable names as arguments to

errMsg()

. For

example:

The following example shows how the string, along with any variables to embed, is passed to the

alert()

function.

if (fileMissing)

{

alert( errMsg(dw.loadString("featureX/fileNotFoundInFolder"),fileName,

folderName) );

}

Working with the Extension Manager

If you create extensions for others users, you must package them according to the guidelines on the Adobe Exchange
website (

www.adobe.com/go/exchange

) under the Help > How to Create an Extension category. After you have

written and tested an extension in the Extension Manager, select File > Package Extension. After the extension is
packaged, you can submit it to the Exchange from the Extension Manager by selecting File > Submit Extension.

The Adobe Extension Manager comes with Dreamweaver. Details about its use are available in its Help files and on
the Adobe Exchange website.

This manual is related to the following products: