
20
EXTENDING DREAMWEAVER CS4
Customizing Dreamweaver
Providing localized strings
Within a document type definition file, the <title> and <description> subtags specify the display title and
description for the document type. You can use the
MMString:loadstring directive in the subtags as a placeholder
for providing localized strings for the two subtags. This process is similar to server-side scripting where you specify a
particular string to use in your page by using a string identifier as a placeholder. For the placeholder, you can use a
special tag or you can specify a tag attribute whose value is replaced.
Provide localized strings
1 Place the following statement at the beginning of the document type definition file:
<?xml version="1.0" encoding="utf-8"?>
2 Declare the MMString namespace in the <documenttypes> tag:
<documenttypes
xmlns:MMString="http://www.adobe.com/schemes/data/string/">
3 At the location in the document type definition file where you want to provide a localized string, use the
MMString:loadstring directive to define a placeholder for the localized string. You can specify this placeholder
in one of the following ways:
<description>
<loadstring>myJSPDocType/Description</loadstring>
</description>
Or
<description>
<loadstring id="myJSPDocType/Description" />
</description>
In these examples, myJSPDocType/Description is a unique string identifier that acts as a placeholder for the
localized string. The localized string is defined in the next step.
4 In the Configuration/Strings folder, create a new XML file (or edit an existing file) that defines the localized string.
For example, the following code, when placed in the Configuration/Strings/strings.xml file, defines the
myJSPDocType/Description string:
<strings>
...
<string id="myJSPDocType/Description"
value=
"<![CDATA[JavaServer Page with <em>special</em> features]]>"
/>
...
</strings>
Note: String identifiers, such as myJSPDocType/Description in the previous example, must be unique within the
application. Dreamweaver, when it starts, parses all XML files within the Configuration/Strings folder and loads these
unique strings.
Rules for document type definition files
Dreamweaver lets document types that are associated with a server model share file extensions. For example, ASP-JS
and ASP-VB can claim .asp as their file extension. (For information on which server model gets preference, see
“canRecognizeDocument()” on page 322.)
Comentários a estes Manuais