Specifications
Chapter 19234
The fields in the Property inspector are still editable; users can enter values for attributes that
might be controlled by server markup, which results in duplicate attributes. If both a translated
value and a regular value are set for a particular attribute, Dreamweaver displays the translated
value in the Document window. You must decide whether your translator looks for duplicate
attributes and remove them.
Locking translated tags or blocks of code
In most cases, you want a translator to change markup so that Dreamweaver can display it, but
you want the original markup—not the changes—to be saved. To address this need,
Dreamweaver provides special XML tags in which to wrap translated content and to refer to the
original code.
When you use these XML tags, the contents of the original attributes are duplicated in Code
view. If the file is saved, the original, untranslated markup is written to the file. The untranslated
content is what Dreamweaver displays in Code view.
The syntax of the XML tags is shown in the following example:
<MM:BeginLock translatorClass="translatorClass" ¬
type="tagNameOrType" depFiles="dependentFilesList" ¬
orig="encodedOrignalMarkup">
Translated content
<MM:EndLock>
where:
translatorClass is the unique identifier for the translator (the first string in the array that
getTranslatorInfo() returns).
tagNameOrType is a string that identifies the type of markup (or the tag name that is associated
with the markup) that is contained in the lock. The string can contain only alphanumeric,
hyphen (-), or underscore (_) characters. You can check this value in the
canInspectSelection() function of a custom Property inspector to determine if the Property
inspector is the right one for the content. For more information, see “Creating Property
inspectors for locked content” on page 239. Locked content cannot be inspected by any of the
Dreamweaver built-in Property inspectors. For example, specifying
type="IMG" does not make
the Image panel appear.
dependentFilesList is a string that contains a comma-separated list of files on which the locked
markup depends. Files are referenced as URLs, relative to the user’s document. If the user updates
one of the files in the
dependentFilesList, Dreamweaver automatically retranslates the content
in the document that contains the list.
encodedOriginalMarkup is a string that contains the original, untranslated markup, encoded
using a small subset of URL encoding (use
%22 for ", %3C for <, %3E for >, and %25 for
%
). The quickest way to URL-encode a string is to use the escape() method. For example, if
myString equals ’<img src="foo.gif">’, escape(myString) returns
%3Cimg%20src=%22foo.gif%22%3E.