beautypg.com

Inspecting translated attributes, Locking translated tags or blocks of code, Original code (see – Adobe Extending Dreamweaver CS4 User Manual

Page 337

background image

331

EXTENDING DREAMWEAVER CS4

Data translators

Translating more than one attribute at a time
The

mmTranslatedValue

attribute can contain more than one valid attribute-value pair. Consider the following

untranslated code:

src="closed.jpg" width="100" height="320" ?> alt="We're open 24 hours a day from
12:01am Monday until 11:59pm Friday">

The following example shows how the translated markup might appear:

src="closed.jpg" width="100" height="320" ?>
mmTranslatedValue="src=%22open.jpg%22 width=%22320%22 height=%22100%22"
alt="We're open 24 hours a day from 12:01am Monday until 11:59pm Friday">

The spaces between the attribute-value pairs in the

mmTranslatedValue

attribute are not encoded. Because

Dreamweaver looks for these spaces when it attempts to render the translated value, each attribute-value pair in the

mmTranslatedValue

attribute must be encoded separately and then pieced back together to form the full

mmTranslatedValue

attribute. For an example of this process, see “

A simple attribute translator example

” on

page 336.

Inspecting translated attributes

Translated attributes do not require locks, which makes it simple to inspect the tags that contain them.

When a server markup specifies a single attribute that is represented in a Property inspector, Dreamweaver displays it
in the Property inspector.

The markup appears irrespective of whether a translator is associated with it. The translator runs whenever the user
edits the server markup that appears in the Property inspector.

When server markup controls more than one attribute in a tag, the server markup does not appear in the Property
inspector. However, the lightning bolt icon shows that translated markup exists for the selected element.

Note: The lightning bolt icon does not appear when text or table cells, rows, or columns are selected. Translation continues
if the user edits server markup in the panel and a translator exists to handle that type of markup.

The text boxes in the Property inspector are editable; users can enter values for attributes that server markup controls.
It 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, decides whether your translator searches for
duplicate attributes and removes them.

Locking translated tags or blocks of code

In most cases, you want a translator to change the markup so that Dreamweaver can display it, but you want to save
the original markup, not the changes. For such cases, 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:

This manual is related to the following products: